无法在调试文件夹外运行应用程序。 [英] Can't run the application outside the debug folder.

查看:55
本文介绍了无法在调试文件夹外运行应用程序。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚完成了我的应用程序,但是当我在桌面上移动exe时出现了这个错误:

 System.IO.FileNotFoundException: 加载 文件   assembly  '  HttpService,Version = 1.0.0.0,Culture =中性,PublicKeyToken = null' 一个 其依赖项。可以 找到文件
文件名称:' HttpService,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = null'





我错过了什么吗?



任何帮助都将受到高度赞赏。

解决方案

原因可能不同。



请参阅我的两个全面的答案,解释如何使用各种途径:

如何找到我的程序目录可执行目录),

如何查找我的程序目录特殊文件夹,工作目录)。



我我想重申一下,使用任何硬编码文件路径都没有用处。在所有情况下,应根据用户输入,配置文件等在运行时根据上述方法计算路径。



-SA


你好Maxbre,



您可能正在使用文件的相对路径(哪个文件?)是相对于Debug文件夹找到的,但不是与Release文件夹相同的相对路径。



干杯,

Edo

Hi, I just finished my application, but when I moved the exe on my desktop I got this error:

System.IO.FileNotFoundException: Could not load file or assembly 'HttpService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Can not find the file.
File name: 'HttpService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'



did I miss anything?

any help would be highly appreciated.

解决方案

The reasons can be different.

Please see my two comprehensive answers which explain how to work with all kinds of paths:
How to find my programs directory (executable directory),
How to find my programs directory ("special folders", working directory).

I want to reiterate that there are no situation when using any hard-coded file path can be useful. In all cases, paths should be calculated during run time based on user input, configuration files, etc, based on the methods I described above.

—SA


Hi Maxbre,

You are probably using a relative path to a file (which file?) that is found relative to the Debug folder, but not in the same relative path to the Release folder.

Cheers,
Edo


这篇关于无法在调试文件夹外运行应用程序。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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