Changing the permissions on a folder for a user
When you set permissions on a folder, all of the files that are created within that folder after that point will inherit those permissions. This accommodates the Windows Installer's sequence, which as luck would have it, creates folders first and then adds files to them. This means we can set permissions once and let them trickle down. In this recipe, we'll give a user named Joe full access to a folder.
Getting ready
To prepare for this recipe, perform the following steps:
- Create a new setup project and name it
FolderPermissionsInstaller
. - Add a text file named
Sample.txt
to the project. After installation, we can verify that the permissions that were set on the folder propagated to this file. Add aComponent
element to include it in the installation:<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER"> <Component Id="cmpSampleTXT" Guid="{79972677...