Monday 16 March 2015

Creating copies of DLL files in ASP.NET BIN folder

I often (though not always) create backups of DLL files before replacing them with a newer version. This is usually done with a purpose of storing a trail, and to be able to rollback to the most recent working version in case of any emergency.

Based on my recent experience, I can give an advice: when creating a reserve copy, change its *.dll extension to something else, for example to "*dll.copy.20150316". 

What I did: I created a copy of a dll that looked like "mycompany.mylibrary.myservice - Copy.dll", and then replaced the original "mycompany.mylibrary.myservice.dll" file with a newer version.

Somehow after that, the application had created (or retained?) a link to the copy instead of the main dll file. It started throwing an error "Could not load file or assembly 'mycompany.mylibrary.myservice - Copy.dll' or one of its dependencies. The located assembly's manifest does not match the assembly reference. (Exception from HRESULT: 0x80131040)".

No comments:

Post a Comment