I've built a Windows Application using c#, on Windows 7.
Everything was working fine, so I've created a Setup Wizard project and then built it. Once I install the app, I can open it correctly, but when I try to make some action that writes a text file(with logging purposes) it crashes, thrwoing me the following error message:
Access to the path 'C:\Program Files (x86)\MSProgram\MSProgram\ErrorLog.xml' is denied.

Hemant SrivastavaRank #581 · 4.2K reputationPosted Nov 15, 2012, 9:08 AM EST
Either you are not closing your StreamWriter object
Guess-2: Or you may have this kind of problem:
One time in my company, a security patch came and we started getting error of our already installed Test Tool application in which we were writing files for logging purpose in a specific folder. That security patch basically was setting that folder and its files to "Read Only".
So we fix this by setting files properties as NORMAL:
private void SetMapFilesAttributes() { try { // Get the File Location from app.config String sFileLocation = ConfigurationManager.AppSettings["Data_Location"]; // Get all the file collection from that directory string[] fileCollection = Directory.GetFiles(sFileLocation); // Setting attribute for each file foreach (String file in fileCollection) { File.SetAttributes(file, FileAttributes.Normal); } } catch (Exception ex) { throw ex; } } If it helps you, pls mark it accepted. ThanksSuthish NairRank #92 · 22.8K reputationPosted Nov 15, 2012, 1:06 AM EST
You already have one thread active, do not create duplicates..
http://www.c-sharpcorner.com/Forums/Thread/193788/help-with-setup-project.aspx