Visual c++ 当启动依赖于第三方dll的程序时,程序初始化失败(0xc0150002) 当我编写C++程序时(比如B3Dest.exe)依赖于第三方DLL(这样的B3DVIEWS.DLL)(供应商是小公司)。我编写的程序非常简单,只需测试dll中的一个函数。启动程序时(所需的头文件、.lib文件和.dll文件被链接)。我遇到了下面的问题 The application failed to initialize properly (0xc0150002). Click on OK to terminate the application.

Visual c++ 当启动依赖于第三方dll的程序时,程序初始化失败(0xc0150002) 当我编写C++程序时(比如B3Dest.exe)依赖于第三方DLL(这样的B3DVIEWS.DLL)(供应商是小公司)。我编写的程序非常简单,只需测试dll中的一个函数。启动程序时(所需的头文件、.lib文件和.dll文件被链接)。我遇到了下面的问题 The application failed to initialize properly (0xc0150002). Click on OK to terminate the application.,visual-c++,dll,visual-studio-2005,side-by-side,winsxs,Visual C++,Dll,Visual Studio 2005,Side By Side,Winsxs,我发现程序在进入我的主要功能之前退出了。vs2008 IDE的输出是 LDR: LdrpWalkImportDescriptor() failed to probe e:\tlh1987\vs2008projects\B3DTest\Debug\B3DViews.dll for its manifest, ntstatus 0xc0150002 我把程序和dll放在另一台目标计算机上,它工作正常。所以我想一定是我的电脑出了问题。我搜索了事件日志,上面写着三个事件 EventID: 32 Des

我发现程序在进入我的主要功能之前退出了。vs2008 IDE的输出是

LDR: LdrpWalkImportDescriptor() failed to probe e:\tlh1987\vs2008projects\B3DTest\Debug\B3DViews.dll
for its manifest, ntstatus 0xc0150002
我把程序和dll放在另一台目标计算机上,它工作正常。所以我想一定是我的电脑出了问题。我搜索了事件日志,上面写着三个事件

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.
<>我在网上搜索发现有人安装了代码>微软Visual C++ 2005可重分配包< /> >和<微软Visual C++ 2005 SP1可重分发包(x86)。 我下载了这两个文件并安装了它。然而,它不能工作! internet上的另一个解决方案是将Microsoft.VC80.CRT文件夹的文件(包括3个dll和Microsoft.VC80.MFC文件夹(也包括4个dll))以及相应的清单文件放在B3DTest.exe(我的程序)的目录中。然而,它仍然不起作用!但是事件日志发生了一些变化,其中只有1个
事件错误,如下所示:

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.
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<dependency>
  <dependentAssembly>
  <assemblyIdentity type="win32" name="Microsoft.VC80.CRT" version="8.0.50727.6195"    
  processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
  </dependentAssembly>
</dependency>
<dependency>
  <dependentAssembly>
  <assemblyIdentity type="win32" name="Microsoft.VC80.MFC" version="8.0.50727.6195" 
processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
  <assemblyIdentity type="win32" name="Microsoft.VC80.CRT" version="8.0.50608.0" 
  processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
  </dependentAssembly>
</dependency>
<dependency>
  <dependentAssembly>
  <assemblyIdentity type="win32" name="Microsoft.VC80.MFC" version="8.0.50608.0" 
  processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
  </dependentAssembly>
</dependency>
</assembly>
Started "B3DTEST.EXE" (process 0x680) at address 0x00400000.  Successfully hooked module.
Loaded "NTDLL.DLL" at address 0x7C920000.  Successfully hooked module.
Loaded "KERNEL32.DLL" at address 0x7C800000.  Successfully hooked module.
DllMain(0x7C920000, DLL_PROCESS_ATTACH, 0x00000000) in "NTDLL.DLL" called.
DllMain(0x7C920000, DLL_PROCESS_ATTACH, 0x00000000) in "NTDLL.DLL" returned 1 (0x1).
DllMain(0x7C800000, DLL_PROCESS_ATTACH, 0x00000000) in "KERNEL32.DLL" called.
DllMain(0x7C800000, DLL_PROCESS_ATTACH, 0x00000000) in "KERNEL32.DLL" returned 1 (0x1).
Injected "DEPENDS.DLL" at address 0x08370000.
DllMain(0x08370000, DLL_PROCESS_ATTACH, 0x00000000) in "DEPENDS.DLL" called.
DllMain(0x08370000, DLL_PROCESS_ATTACH, 0x00000000) in "DEPENDS.DLL" returned 1 (0x1).
Loaded "B3DVIEWS.DLL" at address 0x10000000.  Successfully hooked module.
LDR: LdrpWalkImportDescriptor() failed to probe e:\tlh1987\vs2008projects\b3dtest\debug\B3DViews.dll 
for its manifest, ntstatus 0xc0150002
First chance exception 0xC0150002 (Unknown) occurred in "NTDLL.DLL" at address 0x7C9873BE.
**Second chance exception 0xC0150002 (Unknown) occurred in "NTDLL.DLL" at address 0x7C9873BE.**
Exited "B3DTEST.EXE" (process 0x680) with code -1072365566 (0xC0150002).
有人告诉我,可能是我电脑中VC80.CRT和VC80.MFC的版本与
B3DViews.dll
(由供应商分发)中的版本号不匹配。然后我用emacs.exe打开
B3DViews.dll
,并搜索附加到dll的清单。它说:

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.
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<dependency>
  <dependentAssembly>
  <assemblyIdentity type="win32" name="Microsoft.VC80.CRT" version="8.0.50727.6195"    
  processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
  </dependentAssembly>
</dependency>
<dependency>
  <dependentAssembly>
  <assemblyIdentity type="win32" name="Microsoft.VC80.MFC" version="8.0.50727.6195" 
processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
  <assemblyIdentity type="win32" name="Microsoft.VC80.CRT" version="8.0.50608.0" 
  processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
  </dependentAssembly>
</dependency>
<dependency>
  <dependentAssembly>
  <assemblyIdentity type="win32" name="Microsoft.VC80.MFC" version="8.0.50608.0" 
  processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
  </dependentAssembly>
</dependency>
</assembly>
Started "B3DTEST.EXE" (process 0x680) at address 0x00400000.  Successfully hooked module.
Loaded "NTDLL.DLL" at address 0x7C920000.  Successfully hooked module.
Loaded "KERNEL32.DLL" at address 0x7C800000.  Successfully hooked module.
DllMain(0x7C920000, DLL_PROCESS_ATTACH, 0x00000000) in "NTDLL.DLL" called.
DllMain(0x7C920000, DLL_PROCESS_ATTACH, 0x00000000) in "NTDLL.DLL" returned 1 (0x1).
DllMain(0x7C800000, DLL_PROCESS_ATTACH, 0x00000000) in "KERNEL32.DLL" called.
DllMain(0x7C800000, DLL_PROCESS_ATTACH, 0x00000000) in "KERNEL32.DLL" returned 1 (0x1).
Injected "DEPENDS.DLL" at address 0x08370000.
DllMain(0x08370000, DLL_PROCESS_ATTACH, 0x00000000) in "DEPENDS.DLL" called.
DllMain(0x08370000, DLL_PROCESS_ATTACH, 0x00000000) in "DEPENDS.DLL" returned 1 (0x1).
Loaded "B3DVIEWS.DLL" at address 0x10000000.  Successfully hooked module.
LDR: LdrpWalkImportDescriptor() failed to probe e:\tlh1987\vs2008projects\b3dtest\debug\B3DViews.dll 
for its manifest, ntstatus 0xc0150002
First chance exception 0xC0150002 (Unknown) occurred in "NTDLL.DLL" at address 0x7C9873BE.
**Second chance exception 0xC0150002 (Unknown) occurred in "NTDLL.DLL" at address 0x7C9873BE.**
Exited "B3DTEST.EXE" (process 0x680) with code -1072365566 (0xC0150002).
这让我发疯。我不想弄明白。任何帮助都将不胜感激
这个()可能有助于解决这个问题。但我无法通过阅读理解它。
我的系统是windows xp sp3,我使用VS2008。我没有安装VS2005。

我不知怎么搞明白了。在这个问答的帮助下

<>首先,我卸载了所有的代码>微软Visual C++ 2005可再发行包< /COD> < /P> <>第二,我直接安装了微软Visual C++ 2005 SP1可重分发包(x86)< /COD>。它也不起作用,但当我安装


它只是工作。更新版删除了<代码>微软Visual C++ 2005可重分配包<代码>,然后使新的一个(SP1)包工作。

< P>首先,我卸载了所有微软Visual C++ 2005可再分发包。 第二,我直接安装微软Visual C++ 2005 SP1可重分发包(x86)。它也不起作用,但当我安装

Visual C++ 2005 Service PACK 1可重分发包MFC安全更新< /P>


它只是工作

0xC0150002L
状态
。调试激活上下文问题的工具是
SxsTrace
。试试这个:

touch program.exe
SxsTrace Trace -logfile:SxsTrace.etl
[run program.exe]
SxsTrace Parse -logfile:SxsTrace.etl -outfile:SxsTrace.txt

SxsTrace.txt将包含引用的程序集的名称,但找不到该程序集。

该清单混乱,看起来该DLL与使用VS2005测试版生成的代码链接。您需要获得更好的版本,请与供应商或作者联系以获得支持。@HansPassant但它在我同事的计算机上运行良好。我只是想让它工作。可能很难联系供应商。似乎只有我的电脑在启动程序时出现故障。@汉帕桑感谢您的帮助。很难相信,仅仅因为相对努力,就没有人对这台电脑投赞成票:+1这是非常宝贵的,好先生!谢谢你发布这个。