visual-studio-2013windows-installerdeployment-project

Visual Studio Deployment Project - How to give a user write access to a resource file


In a Visual Studio (2013) Deployment Project, I have a resource file (a text-file called settings.cfg) that shall be copied to the application folder. The ReadOnly-Property of that file is set to False.

After installation on the target platform (Win 7 Pro), the file is present (in the application folder), but the file may not be modified by a user without Admin-Rights, it is read-only.

Obviously in the windows-explorer you can modify the access options in the properties dialog, but you need admin rights + time/effort.

Is there a way to allow modification of the file by any user right from Visual Studio?


Solution

  • Editorial answer: Don't install files in the Program Files folder if you want limited users to be able to update them. There are folders like User's Application Data Folder that are actually for the user's data.

    The practical answer is that there is nothing built in to Visual Studio setups to do this, so that means writing custom action code to change the access rights. That's really a "how do I change access rights on a file" question rather than a question on setup projects. I suspect the code and setup changes to move that file to a location where it just works might be easier.

    Lots of examples of custom actions here:

    https://www.google.com/?gws_rd=ssl#q=visual+studio+custom+action+walkthrough

    and this should help too:

    https://www.simple-talk.com/dotnet/visual-studio/visual-studio-setup---projects-and-custom-actions/