LoadLibrary fails with ERROR_SXS_CANT_GEN_ACTCTX (the dll depends on VS2005 CRT 8.0.50727.4053)

与世无争的帅哥 提交于 2019-12-12 06:36:56

问题


I have a third-party DLL that is built with Visual Studio 2005, which I use in a project that is built with Visual Studio 2008. This DLL depends on VS2005 CRT, version 8.0.50727.4053.

On Windows 7 it works, but on Vista and XP LoadLibrary fails with a side by side error. The is from the Event Viewer:

Activation context generation failed for "C:\MyLibrary.dll". Dependent Assembly Microsoft.VC80.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.4053" could not be found. Please use sxstrace.exe for detailed diagnosis.

I've tried copying msvcm80.dll,msvcp80.dll,msvcr80.dll from x86_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.4053_none_d08d7da0442a985d on my computer to the same directory as the DLL, but LoadLibrary still fails and the same error is in the Event Viewer.

This is the output from sxstrace.exe:

=================
Begin Activation Context Generation.
Input Parameter:
    Flags = 0
    ProcessorArchitecture = x86
    CultureFallBacks = en-US;en
    ManifestPath = C:\MyDir\MyLibrary.dll
    AssemblyDirectory = C:\MyDir\
    Application Config File = 
-----------------
INFO: Parsing Manifest File C:\MyDir\MyLibrary.dll.
    INFO: Manifest Definition Identity is (null).
    INFO: Reference: Microsoft.VC80.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.4053"
INFO: Resolving reference Microsoft.VC80.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.4053".
    INFO: Resolving reference for ProcessorArchitecture x86.
        INFO: Resolving reference for culture Neutral.
            INFO: Applying Binding Policy.
                INFO: Find publisher policy at C:\Windows\WinSxS\manifests\x86_policy.8.0.microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.4016_none_5169e8e10f4ca52d.manifest
                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_32\Microsoft.VC80.CRT\8.0.50727.4053__1fc8b3b9a1e18e3b\Microsoft.VC80.CRT.DLL.
                INFO: Attempt to probe manifest at C:\MyDir\Microsoft.VC80.CRT.DLL.
                INFO: Attempt to probe manifest at C:\MyDir\Microsoft.VC80.CRT.MANIFEST.
                INFO: Attempt to probe manifest at C:\MyDir\Microsoft.VC80.CRT\Microsoft.VC80.CRT.DLL.
                INFO: Attempt to probe manifest at C:\MyDir\Microsoft.VC80.CRT\Microsoft.VC80.CRT.MANIFEST.
                INFO: Did not find manifest for culture Neutral.
            INFO: End assembly probing.
    ERROR: Cannot resolve reference Microsoft.VC80.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.4053".
ERROR: Activation Context generation failed.
End Activation Context Generation.

回答1:


You need to install a redistributable package for VS2005. Unfortunately, there are several of them for different service pack levels, security fixes and so on.

In general, to find the one you want Google the version number of the DLL that isn't loading (8.0.50727.4053 in this case).

You'll probably find a link to the right package.




回答2:


You need to install the Microsoft Visual C++ 2005 redistributable.



来源:https://stackoverflow.com/questions/12514760/loadlibrary-fails-with-error-sxs-cant-gen-actctx-the-dll-depends-on-vs2005-crt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!