comassembly-binding-redirectassemblybinding

Assembly-Binding Error on shared Component


I have the folloing structure after setting up one of our programs on the customers machine:

c:\Program Files (x86)\Common Files\company\DLL\LicenseServer\

c:\Program Files (x86)\company\FancyProg1\

MyProg1.exe is using the LicenseServer.dll from the common files-folder which by itself has a reference to Tools.dll. The reference at the Licenserver was build with "SpecificVersion=False". LicenseServer ist registered via Regasm /codebase for use as com-server as well

Now the user wants to setup another Program which also uses LicenseServer.

After that my Folders look like this c:\Program Files (x86)\Common Files\company\DLL\LicenseServer\

c:\Program Files (x86)\company\FancyProg2\

It's setup contains LicenseServer.dll still in V1.0 but the Tools.dll has evolved to V1.1 (some additional Methods, but no change in any public methods definition). The LicenseServer of MyProg2 was build with a Reference to Tools.dll V1.1 (still with "Specific Version=False") but has no other change so its still V1.0.

While setting MyProg2 on the target-machine the setup-Program does not Copy LicenseServer.dll because it has the same version that the one already installed. Yet it updates the Tools.dll from V1.0 to V1.1 because is brings a newer one.

Well, after that MyProg2 cannot reference LicenseServer. It won't load Tools.dll because it still searches for V1.0. Notice that MyProg2 is a native-c++-program with uses LicenseServer as a Com-Server. Its registered via Regasm /codebase.

However, MyProg1 (the .net-program which loads LicenseServer as a regular .net-dll) works and uses the newer Tools.dll

So the question is: how to make LicenseServer as a Com-Server work, even when there is a newer Tolls.dll in it.


Solution

  • The trick is not to version LicenseServer and all its references independently, but to give them all a new, same version number everytime Prog2 gets a new release. Even when there was noch change in the sources. This prevents only one component from being updated because it is newer. During setup, either all or no components are then replaced