I have a content folder at /Data
in my project. When I build it and also when I used the visual studio installation creater, the files are there. When I run the program, it says it is denied access to these files. How do I let the program have access to the file?
The files are in the same directory as the exe. If I just run the file in the debug output folder, it runs fine, just when installed and it goes in the program files.
To expand a bit further on @Lolcoder 's answer. In my applications I use Environment.GetEnvironmentVariable("ALLUSERSPROFILE")
and append my application directorys to that directory. I then use a Custom Commit Action in Windows Installer to run a Batch File to transfer my files from the program directory to the All Users directory.
md "%ALLUSERSPROFILE%\YourApplicationName"
md "%ALLUSERSPROFILE%\YourApplicationName\Data"
cacls "%ALLUSERSPROFILE%\YourApplicationName" /E /P BUILTIN\Users:F
copy "C:\Program Files\YourApplicationName\Data\*.*" "%AllUSERSPROFILE%\YourApplicationName\Data"
This allows me to have application level settings that are not user specific.