Search code examples
windowsdllmanifestsxs

How to resolve "two assemblies with same name"


I have an application which uses version 8.0.50727.5592 of the CRT. One of the dependent libraries uses version 8.0.50727.762. When I run the application on a machine with version 8.0.50727.4940 installed, I get a "side-by-side configuration is incorrect" error. Using sxstrace, I get the following result:

=================
Begin Activation Context Generation.
Input Parameter:
    Flags = 0
    ProcessorArchitecture = AMD64
    CultureFallBacks = en-US;en
    ManifestPath = F:\Temp\Temp.exe
    AssemblyDirectory = F:\Temp\
    Application Config File = F:\Temp\Temp.exe.Config
-----------------
INFO: Parsing Application Config File F:\Temp\Temp.exe.Config.
INFO: Parsing Manifest File F:\Temp\Temp.exe.
    INFO: Manifest Definition Identity is (null).
    INFO: Reference: Microsoft.VC80.CRT,processorArchitecture="amd64",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.762"
    INFO: Reference: Microsoft.VC80.CRT,processorArchitecture="amd64",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.5592"
INFO: Resolving reference Microsoft.VC80.CRT,processorArchitecture="amd64",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.762".
    INFO: Resolving reference for ProcessorArchitecture amd64.
        INFO: Resolving reference for culture Neutral.
            INFO: Applying Binding Policy.
                INFO: Find publisher policy at C:\Windows\WinSxS\manifests\amd64_policy.8.0.microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.4940_none_09c03a53facd313f.manifest
                INFO: Publisher Policy redirected assembly version.
                INFO: Post policy assembly identity is Microsoft.VC80.CRT,processorArchitecture="amd64",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.4940".
            INFO: Begin assembly probing.
                INFO: Attempt to probe manifest at C:\Windows\WinSxS\manifests\amd64_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.4940_none_88df89932faf0bf6.manifest.
                INFO: Manifest found at C:\Windows\WinSxS\manifests\amd64_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.4940_none_88df89932faf0bf6.manifest.
            INFO: End assembly probing.
INFO: Resolving reference Microsoft.VC80.CRT.mui,language="*",processorArchitecture="amd64",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.4940".
    INFO: Resolving reference for ProcessorArchitecture amd64.
        INFO: Resolving reference for culture en-US.
            INFO: Applying Binding Policy.
                INFO: No publisher policy found.
                INFO: No binding policy redirect found.
            INFO: Begin assembly probing.
                INFO: Did not find the assembly in WinSxS.
                INFO: Attempt to probe manifest at C:\Windows\assembly\GAC_64\Microsoft.VC80.CRT.mui\8.0.50727.4940_en-US_1fc8b3b9a1e18e3b\Microsoft.VC80.CRT.mui.DLL.
                INFO: Did not find manifest for culture en-US.
            INFO: End assembly probing.
        INFO: Resolving reference for culture en.
            INFO: Applying Binding Policy.
                INFO: No publisher policy found.
                INFO: No binding policy redirect found.
            INFO: Begin assembly probing.
                INFO: Did not find the assembly in WinSxS.
                INFO: Attempt to probe manifest at C:\Windows\assembly\GAC_64\Microsoft.VC80.CRT.mui\8.0.50727.4940_en_1fc8b3b9a1e18e3b\Microsoft.VC80.CRT.mui.DLL.
                INFO: Did not find manifest for culture en.
            INFO: End assembly probing.
INFO: Resolving reference Microsoft.VC80.CRT,processorArchitecture="amd64",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.5592".
    INFO: Resolving reference for ProcessorArchitecture amd64.
        INFO: Resolving reference for culture Neutral.
            INFO: Applying Binding Policy.
                INFO: No binding policy redirect found.
            INFO: Begin assembly probing.
                INFO: Did not find the assembly in WinSxS.
                INFO: Attempt to probe manifest at C:\Windows\assembly\GAC_64\Microsoft.VC80.CRT\8.0.50727.5592__1fc8b3b9a1e18e3b\Microsoft.VC80.CRT.DLL.
                INFO: Attempt to probe manifest at F:\Temp\Microsoft.VC80.CRT.DLL.
                INFO: Attempt to probe manifest at F:\Temp\Microsoft.VC80.CRT.MANIFEST.
                INFO: Attempt to probe manifest at F:\Temp\Microsoft.VC80.CRT\Microsoft.VC80.CRT.DLL.
                INFO: Attempt to probe manifest at F:\Temp\Microsoft.VC80.CRT\Microsoft.VC80.CRT.MANIFEST.
                INFO: Manifest found at F:\Temp\Microsoft.VC80.CRT\Microsoft.VC80.CRT.MANIFEST.
            INFO: End assembly probing.
ERROR: Two assemblies have the same assembly name with different version. Assembly 1: F:\Temp\Microsoft.VC80.CRT\Microsoft.VC80.CRT.MANIFEST. Assembly 2: INFO: Manifest found at F:\Temp\Microsoft.VC80.CRT\Microsoft.VC80.CRT.MANIFEST..
ERROR: Activation Context generation failed.
End Activation Context Generation.

To me, it looks like the dependence on version 762 is being "upgraded" to version 4940, whereas the dependence on 5592 obviously cannot be.

I've copied the "Microsoft.VC80.CRT" folder, containing version 5592 of the CRT, into my application folder (i.e., deploying the assemblies as private assemblies). The seems to be recognized at the end, where sxstrace says:

INFO: Manifest found at F:\Temp\Microsoft.VC80.CRT\Microsoft.VC80.CRT.MANIFEST.

Alas, for some reason this is not seen when the reference to version 762 is resolved. How can I force the reference to version 762 to point to version 5592, which is distributed with my application?

Am I wrong about what I think the problem is?

Thanks for your help!


Solution

  • The machine is simply missing the version of the DLL that your application needs. There's little point in trying to work around that, it's not going to come to a good end. Just deploy the .5592 revision of the CRT library. That version will include a policy that redirects .792 to .5592 so everybody is using the same DLL.