无法加载dll

Memorycn 2009-10-13 11:11:29
C#编写的一个程序
在我的系统(Windows XP或 Windows 7 ,安装了VS2008)运行没有问题
在别人的系统(Windows XP,未安装VS,但安装了.net framework 2.0)运行时提示:[Exception] Unable to load DLL 'Caesar.dll': 由于应用程序配置不正确,应用程序未能启动。重新安装应用程序可能会纠正这个问题。 (Exception from HRESULT: 0x800736B1)


具体的提示信息如下:

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.DllNotFoundException: Unable to load DLL '..\..\DLL\Caesar_dll.dll': 由于应用程序配置不正确,应用程序未能启动。重新安装应用程序可能会纠正这个问题。 (Exception from HRESULT: 0x800736B1)
at Caesar.caesar_form.caesar_encrypt(String strings, Int32 key)
at Caesar.caesar_form.encrypt_button1_Click(Object sender, EventArgs e) in F:\Language C#\Classical Cryptology\Classical Cryptology\Caesar.cs:line 161
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework 2.0.50727/mscorlib.dll
----------------------------------------
Classical Cryptology
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///H:/Classical%20Cryptology/Classical%20Cryptology/bin/Debug/Classical%20Cryptology.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.





程序编译的目标环境设置的是.net framework 2.0
dll的路径也没问题(因为在我的系统下可以正常运行)
不知道该怎么解决这个问题
哪位帮忙
谢谢!
...全文
521 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
Memorycn 2009-10-14
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 hide1984 的回复:]
这个是加载第三方DLL的问题。
在你自己的环境下,因为有这个DLL,已经注册的系统的GAC中。
所以在编译的时候,这个DLL就不会copy到你程序生成的bin目录下面。
而别人的机器上GAC中没有这个DLL,bin里也没有,那么。。。。。。。蹦~~~~~


最简单的方法,在你自己的系统上GAC目录里,copy这个DLL('Caesar.dll')到你发布的程序的bin目录下。。。。
[/Quote]

不是这个问题
调用的路径没有问题
在别的地方找到解决方法了
是还需要安装一个C++的运行库
Hide1984 2009-10-14
  • 打赏
  • 举报
回复
这个是加载第三方DLL的问题。
在你自己的环境下,因为有这个DLL,已经注册的系统的GAC中。
所以在编译的时候,这个DLL就不会copy到你程序生成的bin目录下面。
而别人的机器上GAC中没有这个DLL,bin里也没有,那么。。。。。。。蹦~~~~~


最简单的方法,在你自己的系统上GAC目录里,copy这个DLL('Caesar.dll')到你发布的程序的bin目录下。。。。

17,740

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 .NET Framework
社区管理员
  • .NET Framework社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧