[转]Mogre 环境配置问题(Exception from HRESULT: 0x800736B1)

样例程序做好啦,运行报错

Unhandled Exception: System.IO.FileLoadException: Could not load file or assemby "Mogre, Version=1.4.8.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. (Exception from HRESULT: 0x800736B1)
郁闷了几天,终于解决了。

要安装

Microsoft Visual C++ 2008 SP1 Redistributable Package (x86)

安装 vc2005 sp1 就不行

下载地址:vcredist_x86.exe

 

 

转载请保留本行原始链接信息 : http://www.zeali.net/entry/476 MADE 1n ZEAL
标签 ( 开发/理论 ): vs.net ,  error
Could not load file or assembly '... ...' or one of its dependencies. 由于应用程序配置不正确,应用程序未能启动 ...

  两个工程分别是 .net2005下的 C# 和 C++ , C++ 工程使用 C++/CLI 封装了几个功能函数并在 C# 工程中加载使用封装类。在本地运行正常,但发布到其他机器上却出现异常对话框:“  Could not load file or assembly '... ...' or one of its dependencies. 由于应用程序配置不正确,应用程序未能启动。重新安装应用程序可能会纠正这个问题。 ( Exception from HRESULT: 0x800736B1 ) ”。

  这个错误看上去好像是 C++ DLL库本身的问题,其实并不尽然。由于使用了混合模式编译托管 DLL ,所以该 DLL 又会用到非托管的 CRT ( C Run-Time )库。如果机器上没有安装这些被使用到的运行时组件,就会产生类似 HRESULT: 0x8007 的错误。最简单的方法是下载安装 Microsoft Visual C++ 2005 Redistributable Package (x86)以得到代码运行所需的 msvcr80.dll 及 msvcm80.dll 等;也可以到系统盘下的 Program Files\Common Files\Merge Modules 目录下找到包含 CRT 字样的 msm 文件,把这些文件添加到你的安装程序里面可以达到同样的效果;如果 C++ 生成的不是 dll 而是可执行文件的话,也可以按照微软的说明直接把需要的dll拷贝到应用程序目录下。更为细致的分析说明可以参考这里:Bootstrapper for the VC++ 2005 Redists (with MSI 3.1)

  要注意的是,如果你编译 C++ 托管程序集的时候使用的是 Debug 配置的话,生成的 DLL 需要调用的就是 CRT 对应的 debug 版本( msvcr80d.dll 及 msvcm80d.dll 等 )而不是上面那些 Redistributable Package 里面的文件。这样的话即使你使用任何一种方法去安装那些运行时库文件也还是同样会得到错误异常对话框。了解生成的 DLL 到底是 Debug 还是 Release 版本最简单的方法是用文本编辑器打开该 DLL 文件,找到以下类似的内容(一般位于文件末尾处):

  1. <assembly xmlns="urn:schemas-microsoft-com:asm.v1"    
  2.           manifestVersion="1.0">   
  3.   <dependency>   
  4.     <dependentAssembly>   
  5.       <assemblyIdentity type="win32"     
  6.                         name="Microsoft.VC80.DebugCRT"     
  7.                         version="8.0.50608.0"    
  8.                         processorArchitecture="x86"    
  9.                         publicKeyToken="1fc8b3b9a1e18e3b">  
  10.       </assemblyIdentity>  
  11.     </dependentAssembly>  
  12.   </dependency>  
  13.  </assembly>  
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <dependency> <dependentAssembly> <assemblyIdentity type="win32" name="Microsoft.VC80.DebugCRT" version="8.0.50608.0" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"> </assemblyIdentity> </dependentAssembly> </dependency></assembly>

 

  如果看到 Microsoft.VC80.DebugCRT ,那说明该 dll Link的目标是 CRT的Debug版本,如果是 Microsoft.VC80.CRT 则 link 到再分发版本。当我在 VS.net2005 的 IDE 中通过批生成来生成 C# exe 和 C++ dll 的时候,如果当前的活动解决方案配置是 Debug 的话,在 C# 项目的Release输出目录下拷贝的会是 C++ dll 的 Debug 版本文件而不是 Release 版本!所以在发布生成之后确认对应文件的版本还是相当有必要的。

  另一个可能性是如果你的硬盘分区为 FAT32 格式的话, VS.net 在编译 C++ dll 的时候有可能会因为时间戳计算的失误而没有把正确的 Manifest 信息(基本上就是上面提到的那部分 xml 配置信息)写到 dll 里面,导致程序运行时得不到正确的 dependency 信息产生加载错误。所以如果上述操作仍然无法解决错误的话,考虑在“属性->配置属性->清单工具->常规”下把“使用FAT32解决办法”选项设置为"是"。

 

Microsoft.VC90.DebugCRT.manifest
msvcm90d.dll
msvcp90d.dll
msvcr90d.dll

转载于:https://www.cnblogs.com/aooyu/archive/2009/12/17/1626587.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值