Exception from HRESULT: 0x800736B1

[Exception] Unable to load DLL 'zlibdll.dll': 由于应用程序配置不正确,应用程序未能启动。重新安装应用程序可能会纠正这个问题。 (Exception from HRESULT: 0x800736B1)
[Message] System.DllNotFoundException

zlibdll是我对C++ zlib项目的包装,采用P/Invoke方式在.net下调用,一直工作的很好。但在某些机器上会报出上面的错误。出现这个问题并不一定是我的zlibdll.dll有问题,可能是我的dll的以来库有问题。用Dependency Walker看了下,发现可疑依赖项有两个:msvcr80.dll[8.0.50727.1433]和msvcrt.dll[7.0.2600.2180]。为避免平台问题,我将这两个文件也打包一起发行,但很遗憾并没有解决所有的问题,还是有一些机器会出问题。

C++/CLI dll will not load in C# project(Exception from HRESULT: 0x800736B1)

I had the same problem until today (Exception from HRESULT: 0x800736B1).

In my develop. box everything worked fine, but in the test machine that errors appears when a C# app called a DLL compiled with MSVC++2005.

After reading the msdn documentation, this forum and other helpfull sites, I managed to fix it. Maybe this could help someone in the same situation.

1) Install vcredist_x86.exe in the customer/test/deployment machine. It can be found on \Program Files\Microsoft Visual Studio8\Sdk\v2.0BootStrapper\Packages\vcredist_x86

2) Make sure you are using the dll′s RELEASE version. For some reason the dll′s DEBUG version keep getting the same error. (Maybe the MSVC++ 2005 redist does not install the DEBUG required files such as Microsoft.VC80.DebugCRT, didn′t check this, just a thought).

With these two steps I′ve done it. Also you can check if your DLL has the Manifest embedded. Look inside the DLL with a bin editor/reader and look for the xml file with manifestVersion string. If the manifest is not embedded, check for the file in your output dir, something like yourdll.manifest and use the mt.exe tool from the bin dir of vc to include it inside the dll.

System.IO.FileLoadException

Unhandled Exception: System.IO.FileLoadException: Could not load file or assemby 'ACME.PGP, Version=2.0.0.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)

File name: 'ACME.PGP, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null' --->

System.Runtime.InteropServices.COMException (0x800736B1): This application has

failed to start because the application configuration is incorrect. Reinstalling

the application may fix this problem. (Exception from HRESULT: 0x800736B1)

The issue was resolved. I needed the Visual 2005 SP1 CRT library installed. This is part of the Microsoft Visual C++ 2005 SP1 Redistributable Package (x86)

It can be downloaded from http://www.microsoft.com/downloads/details.aspx?familyid=200B2FD9-AE1A-4A14-984D-389C36F85647&displaylang=en

posted @ 2011-06-24 09:03  树根  阅读(1079)  评论(0编辑  收藏  举报