We're using WiX to bundle up our ASP.NET code into an MSI installer, and we need to set the [ComputerName]\IIS_WPG group to have modify permissions on a folder (named "CO") under the installation directory. The directory structure looks like this after install
C:\inetpub\wwwroot\MyApp\CO
The CO folder is actually part of the .NET solution file, and when the application is bundled into an MSI, the CO folder is included automatically because there are XML files underneath it which are marked as "Content" (this means that I don't need to explicitly use CreateFolder to create the CO folder underneath MyApp). These XML files are updated by the application, which is why the IIS_WPG needs modify permission.
My question is, how do I set the permission on the CO folder? I thought that I might be able to create the folder in an attempt to overwrite whatever permissions are included by default but it doesn't set the permission - I'm guessing that's because the folder I'm creating is overwritten by the actual folder in the MSI, thereby overwriting the permissions that I've set.
I thought that I might need to create a CustomAction which gets executed at some point before InstallFinalize, but I'm lost because I don't understand how to link the folder creation to the CustomAction. I've tried this
<InstallExecuteSequence>
<Custom Action="SetPermission" Before="InstallFinalize" />
</InstallExecuteSequence>
<CustomAction Id="SetPermission" Directory="CODIRECTORY">
<Directory Id="CODIRECTORY" Name="CO" LongName="CO">
<Component Id="CODIR" Guid="D28C9DA4-D20F-45E6-9C9B-4687177EDF41" DiskId="1">
<CreateFolder>
<Permission GenericAll="yes" User="[ComputerName]\IIS_WPG" />
<Permission GenericAll="yes" User="Administrators" />
<Permission GenericRead="yes" GenericWrite="yes" User="ASPNET" />
</CreateFolder>
</Component>
</Directory>
</CustomAction>
But that gives me this error
error CNDL0049 : The CustomAction element's DllEntry, Error, ExeCommand, JScriptCall, Script, Value, or VBScriptCall attribute was not found; one of these is required.
error CNDL0005 : The CustomAction element contains an unexpected child element 'Directory'
I've also tried to use PermissionEx, but I get this error when using that
error CNDL0005 : The CreateFolder element contains an unexpected child element 'util:PermissionEx'.
even though I added xmlns:util="http://schemas.microsoft.com/wix/UtilExtension" at the top of the file.
How do I get the CustomAction to work and Folder Permissions correct?