views:

264

answers:

2

I have been deploying several programs into one folder using XCOPY deployment to a shared network drive as it makes it extremely easy for me to update in house programs. These have a shared DLL NNC.dll. It doesn't often get modified but has done recently so when I went to deploy I couldn't overwrite as it is a breaking change.

If I change the Assembly name in the NNC project to say NNC 1.1.dll copying it into the same folder on the network, would the newly deployed programs pick up the new DLL and the old ones NNC.DLL. This is ideally what I would like, but I wouldn't want to deploy and then realize the old programs are picking up the newest version assembly as it has a breaking change in it which I haven't fixed in all projects yet.

The assembly has a strong name and I updated the version number to match.

+1  A: 

Assuming you have:

  • ClassLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f31de59ccff6c2c9

  • ClassLibrary, Version=2.0.0.0, Culture=neutral, PublicKeyToken=f31de59ccff6c2c9

A no code / configuration only solution would be to:

  1. Copy 1.0.0.0 to a new folder called oldbin
  2. Replace 1.0.0.0 with 2.0.0.0
  3. For each old application (by old I mean using previous version of shared dll) add (if it doesn't exist already) a configuration file AppName.exe.config with the following entry:

    <configuration>  
    <runtime>  
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">  
    <dependentAssembly>  
    <assemblyIdentity name="ClassLibrary" publicKeyToken="f31de59ccff6c2c9" culture="neutral" />  
    <codeBase version="1.0.0.0" href="oldbin\ClassLibrary.dll"/>  
    </dependentAssembly>  
    </assemblyBinding>  
    </runtime>  
    </configuration>
    

This way new application will use the new assembly and old applications will get the old assembly from oldbin folder.

Robert Wilczynski
+1  A: 

It worked the way I hoped in my question.

PeteT