发布exe文件出错 [英] Error in release exe file

查看:135
本文介绍了发布exe文件出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





当我在visual studio 2015目录外运行.exe文件时,我面临以下FileNotFoundExemption。如何更正程序集错误。 />


**************异常文本**************

System.IO.FileNotFoundException:无法加载文件或程序集'WinUSBNet,Version = 1.0.3.0,Culture = neutral,PublicKeyToken = null'或其依赖项之一。系统找不到指定的文件。

文件名:'WinUSBNet,Version = 1.0.3.0,Culture = neutral,PublicKeyToken = null'

at xxxxxxxxxxxxxxxxxxxxxxxxxxx(Object sender, EventArgs e)

在System.Windows.Forms.Control.OnClick(EventArgs e)

在System.Windows.Forms.Button.OnClick(EventArgs e)

在System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)

在System.Windows.Forms.Control.WmMouseUp(消息& m,MouseButtons按钮,Int32点击)
(消息& m)

在System.Windows.Forms.ButtonBase.WndProc(消息& m)
$ b $。在System.Windows.Forms.Button.WndProc(消息& m)

在System.Windows.Forms.Control.ControlNativeWindow.OnMessage(消息& m)

在System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)

在System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd,Int32) msg,IntPtr wparam,IntPtr lparam)



WRN:程序集绑定日志记录已关闭。

要启用程序集绑定失败日志记录,请设置注册表值[HKLM \Software\Microsoft \Fusion!EnableLog](DWORD)为1.

注意:程序集绑定失败日志记录会导致一些性能损失。

要关闭此功能,请删除注册表值[HKLM\Software\Microsoft\Fusion!EnableLog]。



我尝试了什么:



我在调试配置中运行。更改配置以从Visual Studio文件夹中释放并放置.exe文件,同时从该位置运行错误发生在库。

Hi,

I am facing the following FileNotFoundExemption when I run the .exe file outside visual studio 2015 directory.How can I correct the assembly error.

************** Exception Text **************
System.IO.FileNotFoundException: Could not load file or assembly 'WinUSBNet, Version=1.0.3.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
File name: 'WinUSBNet, Version=1.0.3.0, Culture=neutral, PublicKeyToken=null'
at xxxxxxxxxxxxxxxxxxxxxxxxxxx(Object sender, EventArgs e)
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)

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

What I have tried:

I was running in debug configuration.Changed configuration to release and placed .exe file out of visual studio folder while running from that location error occured in library.

推荐答案

WinUSBNet DLL必须与可执行文件位于同一目录中。



检查解决方案,了解调试和发布版本之间的差异(例如:构建DLL不处于发布模式或为发布版本指定了不同的输出目录。)
The WinUSBNet DLL must be in the same directory as the executable.

Check your solution for difference between debug and release builds (e.g. building the DLL not in release mode or having specified a different output directory for release build).


这告诉您所需的程序集不在发布目录中,或者不能位于搜索路径中。第一个也是最明显的事情是看看这个目录,看看WinUSBNet是否位于那里。如果是,那么您需要查看该文件的依赖项(您可以使用SysInterals 依赖 [ ^ ]以识别此情况。)
This is telling you that an assembly you require is not present in the release directory, or cannot be located in a search path. The first, and most obvious thing, is to take a look in this directory and see if WinUSBNet is located in there. If it is, then you need to look at what the dependencies on that file are (you can use SysInterals depends[^] to identify this).


这篇关于发布exe文件出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆