ISerialized .Net, C#, Scrum and agile software development

20Feb/110

Patching or updating a single dll in a release

Posted by Pål Eie

Ever had the need to update a release with a minor change to one dll? These steps allow you to update a single dll in a installation from msi etc. Note that all steps are necessary to avoid problems with mismatch in dll references, manifests etc. Trying to update a single dll without these steps normally results in the following error:

Could not load file or assembly MyAssembly, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

To avoid these kind of problems you have to make sure your dll's have the correct versions, and that all references are to the correct versions of all the assemblies (Normal problem whene using "1.0.*" as AssemblyVersion"

  1. Open you Visual Studio solution for the point of the release or todays date if there are no or few changes in the dll you want to update.
  2. Add you fix or change to your source code
  3. Go to references in the project you want to update (called project A)
  4. Delete all the references to projects in your solution (remember the names)
  5. Copy the same dll's from step 3 som programfiles or wherever you have the release installed. Copy the dll's to the bin/release folder of project A.