Reputation: 771
I am trying to include a file that with my Windows Forms application that be read-write for all users. I was able get the Setup Project to install files to the ProgramData folder using a custom folder with DefaultLocation property set to [CommonAppDataFolder]. I was also able to get my program to read these files using Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) . But the files are all marked as read-only for Users.
Is there another folder I should be installing these files to that will offer common access to all users with read-write permissions?
I found a few threads here, here, and here. But they don't answer the question which folder should I be using to get read-write common access for all users.
Any thoughts appreciated. Thanks in advance.
Upvotes: 1
Views: 3484
Reputation: 2398
Creating a subfolder in the CommonApplicationData folder, and setting permissions during installation is correct and is the Microsoft "One True Way":
Question: Where to store read/write data for all users?
Answer: The suggestion for you is to use the ProgramData (%ALLUSERSPROFILE%) folder (e.g, create ProgramData\\) and update the Access Control List (ACL) according to your requirement, during install. The MSDN resource Per-machine Installations at http://msdn2.microsoft.com/en-us/library/aa370810.aspx should be helpful to you.
This is because some applications may legitimately not want regular users to have write access to the folder, perhaps only to allow a service account to write to the central location.
Upvotes: 3