我試圖寫它包含我的安裝程序中一個空白的文本文件,但我發現了以下錯誤;UnauthorizedAccessException
System.UnauthorizedAccessException: Access to the path 'C:\Program Files (x86)\Hex Technologies\wamplocation.txt' is denied.
這似乎是該文件的權限,一旦它的通過我的安裝程序安裝,但我怎麼可以設置文件一旦安裝該文件是完全可修改?這可以通過C#完成嗎?!
EDITTED;
wamp_url = openFileDialog1.FileName.ToString();
String EnviromentPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
StreamWriter outfile = new StreamWriter(EnviromentPath + @"\Hex Technologies\wamplocation.txt");
outfile.Write(wamp_url);
outfile.Close();
Window's 7 ?,如果是這樣,你應該寫入ProgramData而不是Program Files – 2012-03-12 23:52:35