This project has moved and is read-only. For the latest updates, please go here.

Setting Directory Permissions

Nov 10, 2015 at 4:06 AM
How do I use IsWix to set permissions on a folder and all subfolders?

Googling around has said I would use PermissionEx on the CreateFolder however when I look at the MergeModules created by IsWix I do not see any CreateFolder in any of the wxs files.

Am Trying to create an MSI file for a program that never had one before as I need one to do the group policy stuff, it's just a simple one which copies all the files to a directory in Program Files (x86) and creates a desktop shortcut however I need to set the permissions for the 'Everyone' group to have full access to the directory.

Was originally using AdvancedInstaller to do it and although it worked nicely, permissions required Pro which is not cheap.
Nov 11, 2015 at 1:51 PM
The IsWiX files and folder designer only emits CreateFolder elements when you define a folder without any files. Once you add a file or a lower level folder the component and element is removed because it isn't needed.

There are two approaches you could take. One would be to create another merge module just for this purpose. Like Company.Product.FolderPerms. In this merge module you could define only the folder so that the CreateFolder element gets created. Then you could put the permissions elements in by hand. In this way the merge module has a single responsibility and it's inclusion or exclusion can easily be accomplished. It's also more overhead though.

The second approach is to use the *-Custom.wxs fragment that the IsWiX project template creates. Basically it has a ComponentGroup that is referenced by the primary fragment and it has a DirectoryRef that references the primary fragment. In this way you can author just about any WiX XML by hand you want without concern of it being compatible with the graphical designers. The compiler will merge it all together and your authoring will be present in the merge module. In this approach you would define the Directory elements you need, a Component element, CreateFolder element and then add in the permissions you need.

Please let me know if this makes sense and/or if you have any other questions. IsWiX is meant to give you project templates and graphical designers to author the vast majority of your installer logic but it doesn't have full coverage of the entire WiX schema and it's also meant to not hide WiX capabilities and allow you to author additional logic as needed.