Search code examples
c#visual-studio-2008permissionssetup-project

Setup Project and Access Permission


I created a setup project in VS2008. This setup copy some folders/files to the program files folder. Also, it adds some windows environment variables. During the instalation, I am requested to confirm something in a UAC dialog. This works fine, and all files are copied.

The problem begins when my program is running and I have to modify the a file´s content. An exception is thrown, saying that I have no permission. Also, if I try to do the same operation in Windows Explorer => same problem.

My question is: If I have the permission to install my software in program files folder, shouldn´t I be able to write in this folder as well?


Solution

  • Well, it seems that this is a general permission problem. By default normal users (and applications) cannot write to %PROGRAMFILES%. There are folders specially provided for application data storage such as ApplicationData

    The reason the setup does install into program files is because this default behaviour of the Windows Installer. Check this link for more info on the Windows Installer and clickonce setup