I have the following code in an Winform Application
String[] lines = { "LAST MESSAGE", "101" };
File.WriteAllLines("MPP_Config.txt", lines);
On my Development system, the file gets created under Bin\Debug...
Where will the file be created in the client once it is installed in the client system ?
I deploy to a website using Click once Deployment...
I believe it will be created in current working directory of the application. The application might not have access to this directory, especially on systems with UAC, Vista and windows 7. You should probably think about using the application data directory instead.
String[] lines = { "LAST MESSAGE", "101" };
String fileName = Path.combine(System.Deployment.Application.ApplicationDeployment.CurrentDeployment.DataDirectory,"MPP_Config.txt");
File.WriteAllLines(fileName, lines);
I'm guessing it gets created in the debug folder becuse you have been running it in debug mode. If you ran it in release mode then it will be saved in the bin/release folder.
In other words it will be created in the directory in which the application resides. Why not try it? I.e. copy your exe across...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With