Visual Studio/类库错误的工作目录
我有一个类库,它在使用该文件的应用程序的工作目录中搜索 XML 文件。
到目前为止,它一直按预期工作,突然它在 Visual Studio 目录中搜索 - C:/Program Files/Visual Studio 10/IDE/ - 因此无法找到该文件!我确信我已经做了一些事情让它这样做,但我不知道是什么。
有谁知道我如何解决这个问题,并让我的图书馆重新搜索正确的目录?
编辑:由于 WcfSvcHost 位于该目录中,因此 WCF 服务消耗 dll 是否会产生影响?不过,到目前为止,该 dll 已被 WCF 使用,没有出现此问题。
I have a class library which searches for an XML file in the working directory of whichever application is consuming it.
It has worked as intended up until this point, when all of a sudden it's searching in the Visual Studio directory - C:/Program Files/Visual Studio 10/IDE/
- and thusly failing to find the file! I'm sure I've done something to cause it to do that, but I don't know what.
Does anybody know how I can resolve this, and get my library back to searching the proper directory?
EDIT: Could having a WCF service consume the dll have an effect, since the WcfSvcHost is in that directory? The dll has been consumed by WCF up to this point without this issue, however.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
获取工作目录的逻辑是什么?另外,作为健全性检查,您是否尝试过将应用程序移动到几个不同的文件夹以测试结果?
您的应用程序正在选取的 IDE 文件夹中是否可能存在您的类库 dll 的版本?
Whats you logic for getting the working directory? Also just as an (in)sanity check, have you tried moving the app round a few different folders to test the result?
Is it possible there is a version of your class library dll in that IDE folder that your app is picking up?