I'm trying to anyalyse a problem where an assembly ASSEMBLY is dynamically loaded at runtime using
Assembly.loadFrom("filePath")
in some DLL myDLL1. The same ASSEMBLY was statically linked with another DLL myDLL2 in the same solution, and there are calls to both DLLs from the solution, myExecutable, say. This works fine if exactly the same ASSEMBLY is found in the folder the solution is deployed to. ASSEMBLY has, say, .Net version 1.0.1.1 and file version 1.0.1.7
Now a new file version 1.0.1.8 of ASSEMBLY was published which has exaxtly the same .Net version 1.0.1.1 as file version 1.0.1.7 of ASSEMBLY. The assemblies have strong names and the public key token of the different file versions are different, as well. First question: is this reasonable?
If I place the new file version of the assembly into the folder the solution is deployed to, I now get an error. I assume this is because .Net runtime is unhappy about the public key token which is not as expected according to the manifest of myDLL1, could somone confirm this guess?
The fuslogvw output with names adapted to the example description is as follows:
Assembly Binder Log Entry (11.11.2011 @ 13:38:52)
The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
Running under executable myExecutable
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = xxxxx
LOG: DisplayName = ASSEMBLY (Partial)
LOG: Appbase = (folder the solution is deployed to)
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = NULL
Calling assembly : myDLL1, Version=2.1.2.0, Culture=neutral, PublicKeyToken=.....
===
LOG: Start binding of native image ASSEMBLY, Version=1.0.1.1, Culture=neutral, PublicKeyToken=xxxxxxxx.
LOG: IL assembly loaded from ASSEMBLY.
WRN: No matching native image found.
LOG: Bind to native image assembly did not succeed. Use IL image.
I tried to use a bindingRedirect to version 1.0.1.1 first with the public key token from ASSEMBLY file version 1.0.1.8 as produced by sn -Tp and also with the public key token for ASSEMBLY from the manifest information of myDLL1 corresponding to file version 1.0.1.7, but I get the same error. I also added the redirect Information to the myExecutable configuration.
I then tried to use a bindingRedirect to version 1.0.1.2 with the public key token of the newer version of ASSEMBLY. The new file version is loaded but then I get, of course, a revision mismatch.
Can anyone tell me how to use the new file version of ASSEMBLY in this setup without having to replace the whole solution statically linked to the new file version, which, of course, does work?
TIA and best regards,
Thomas