我有一个使用 CRT 版本 8.0.50727.5592 的应用程序。依赖库之一使用版本 8.0.50727.762。当我在安装了版本 8.0.50727.4940 的机器上运行应用程序时,我收到“并排配置不正确”错误。使用 sxstrace,我得到以下结果:
=================
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.
在我看来,对 762 版的依赖似乎正在“升级”到 4940 版,而对 5592 的依赖显然不能。
我已将包含 CRT 版本 5592 的“Microsoft.VC80.CRT”文件夹复制到我的应用程序文件夹中(即,将程序集部署为私有程序集)。似乎在最后被识别,其中 sxstrace 说:
INFO: Manifest found at F:\Temp\Microsoft.VC80.CRT\Microsoft.VC80.CRT.MANIFEST.
唉,由于某种原因,当解决对版本 762 的引用时,看不到这一点。如何强制对版本 762 的引用指向与我的应用程序一起分发的版本 5592?
我认为问题出在哪里是错的吗?
谢谢你的帮助!