Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I guess my other post was deleted for being a little too general, so I've refined it below:</p> <p>The thing to do is make a custom action. It's pretty straightforward, check out the MSDN walkthrough for writing a C# custom action <a href="http://msdn.microsoft.com/en-us/library/d9k65z2d(v=vs.100).aspx">here</a>. You'll put your permission-changing code inside the Install method:</p> <p>Follow the first few steps from the link to get a new installer project referenced from your installer solution. You have to do it this way, so you can build a dll that is called at the end of installation.</p> <p>Actually setting read/write privileges for Users was a little trickier, and the closest I could get was to set for Authenticated Users. I cobbled together a few other solutions I found on the Internet to come up with this:</p> <pre><code>public override void Install(IDictionary stateSaver) { // This gets the named parameters passed in from your custom action string folder = Context.Parameters["folder"]; // This gets the "Authenticated Users" group, no matter what it's called SecurityIdentifier sid = new SecurityIdentifier(WellKnownSidType.AuthenticatedUserSid, null); // Create the rules FileSystemAccessRule writerule = new FileSystemAccessRule(sid, FileSystemRights.Write, AccessControlType.Allow); if (!string.IsNullOrEmpty(folder) &amp;&amp; Directory.Exists(folder)) { // Get your file's ACL DirectorySecurity fsecurity = Directory.GetAccessControl(folder); // Add the new rule to the ACL fsecurity.AddAccessRule(writerule); // Set the ACL back to the file Directory.SetAccessControl(folder, fsecurity); } // Explicitly call the overriden method to properly return control to the installer base.Install(stateSaver); } </code></pre> <p>Then, when you create your custom action, edit its properties, and add something like this under the CustomActionData property:</p> <pre><code>/folder="[CommonAppDataFolder][ProductName]" </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload