简体   繁体   English

Streamreader在某些计算机上找不到文件

[英]Streamreader doesn't find the file on some computers

I have made a application in c# wpf .Net 4.5 that is using ac# library dll assembled in .net 4.0. 我已经在c#wpf .Net 4.5中制作了一个应用程序,该应用程序使用在.net 4.0中组装的ac#库dll。 This dll uses a file that must be in the exe directory. 该dll使用的文件必须位于exe目录中。 On all my computers my application works, but when I send this application to some other computers the application will throw my exceptions that is telling me that the dll I am using is not finding the file. 在我所有的计算机上,我的应用程序都可以运行,但是当我将此应用程序发送到其他计算机上时,该应用程序将抛出异​​常,告诉我正在使用的dll找不到文件。 I have decompiled the dll and checked out the code but it doesn't change the working directory at any point, However it uses it. 我已经反编译了dll并签出了代码,但是它在任何时候都不会更改工作目录,但是它会使用它。

I suspect that this have something to do with the language of the computers but im not sure. 我怀疑这与计算机的语言有关,但我不确定。

I have set the Directory.SetCurrentDirectory(...) to my exe path in alot of diffrent ways without success. 我已经以多种不同的方式将Directory.SetCurrentDirectory(...)设置为我的exe路径,但没有成功。

Does anyone have any clue how to solve this? 有谁知道如何解决这个问题?

Edit: The full auctual error doesnt tell me the path Streamreader looked for the file. 编辑:完全的错误不会告诉我Streamreader查找文件的路径。 I have used Clickonce deployment but for now I copy the binary folder and I guarantee that the file is in the correct spot. 我已经使用Clickonce部署,但是现在我复制了二进制文件夹,并保证文件在正确的位置。

As i suspected this had something to do with the language of the windows. 我怀疑这与窗户的语言有关。

This line fixed the problems, but it would be nice if someone explained why. 此行解决了问题,但是如果有人解释原因,那将是很好的。

System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM