简体   繁体   中英

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. This dll uses a file that must be in the exe directory. 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. 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.

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.

Does anyone have any clue how to solve this?

Edit: The full auctual error doesnt tell me the path Streamreader looked for the file. I have used Clickonce deployment but for now I copy the binary folder and I guarantee that the file is in the correct spot.

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;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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