拿到一个第3方的dll, 写了一个简单的程序测试这个DLL, 但是程序一启动就遇到了下面的错误:
The application failed to initialize properly (0xc0150002). Click on OK to terminate
the application.
找到事件查看器,给出如下的提示:
EventID: 32
Description: Dependent Assembly Microsoft.VC80.CRT could not be found and Last Error was The referenced
assembly is not installed on your system.
EventID: 59
Description: Resolve Partial Assembly failed for Microsoft.VC80.CRT. Reference error message: The
referenced assembly is not installed on your system.
EventID: 59
Description: Generate Activation Context failed for Generate Activation Context
E:\tlh1987\vs2008projects\B3DTest\Debug\B3DViews.dll. Reference error message: The operation completed
successfully.
在系统的C:\Windows\WinSXS 文件夹下搜索的相关的VC80.CRT和VC80.MFC文件(包括dll和manifest),放到程序的目录下,运行程序,还是出现0xc0150002的错误,检查事件查看器,错误变成了只有一下一条:
EventID: 59
Description: Generate Activation Context failed for Generate Activation Context
E:\tlh1987\vs2008projects\B3DTest\Debug\B3DViews.dll. Reference error message: The operation completed
successfully.
在网上查找资料,说是安装
Microsoft Visual C++ 2005 SP1 Redistributable Package (x86)能解决问题。安装之后发现还是不能解决。 最后找到了这篇文章http://social.msdn.microsoft.com/Forums/nb-NO/vssetup/thread/fa559cb7-eabc-4f41-a3bc-84ed7ae089fc 关键是下面这一段:
I recommend you install Visual C++ 2005 SP1 Redistributable which version is 8.0.50727.762.
For Visual C++ 2005 SP1 Redistributable (x86), please download it from:http://www.microsoft.com/download/en/details.aspx?id=5638
For Visual C++ 2005 SP1 Redistributable (x64), please download it from:http://www.microsoft.com/download/en/details.aspx?id=18471
If the update does not solve the problem, please install Visual C++ 2005 Service Pack 1 Redistributable Package MFC Security Update:http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=26347