3

I'm creating a folder structure in WiX in the following manner:

<Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="ProgramFilesFolder">
    <Directory Id="INSTALLFOLDER" Name="MyApp">
  </Directory>
</Directory>
<Directory Id="CommonAppDataFolder">
  <Directory Id="CONFIGFOLDER" Name="MyAppConfig">
    <Directory Id="Configdir1" Name="Configdir1">
    </Directory>        
  </Directory>
  <Directory Id="ProgramMenuFolder">
    <Directory Id="ApplicationProgramsFolder" Name="MyApp"/>
  </Directory>
</Directory>

I'm then populating these directories later on using Component tags like this:

<ComponentGroup Id="ProductConfiguration" Directory="CONFIGFOLDER">         
  <Component Id="ConfigFile1" Guid="*">
    <File Id="ConfigFile1.xml" Name="ConfigFile1.xml" Source="..\Configuration\ConfigFile1.xml" Vital="yes" KeyPath="yes" DiskId="1"/>
  </Component>
  <Component Id="ConfigFile2" Guid="*">
    <File Id="ConfigFile2.xml" Name="ConfigFile2.xml" Source="..\Configuration\ConfigFile2.xml" Vital="yes" KeyPath="yes" DiskId="1"/>
  </Component>
  <Component Id="ConfigFile3" Guid="*">
    <File Id="ConfigFile3.xml" Name="ConfigFile3.xml" Source="..\Configuration\ConfigFile3.xml" Vital="yes" KeyPath="yes" DiskId="1"/>
  </Component>
</ComponentGroup>

My problem is this: WiX creates the Configuration directory (CommonAppDataFolder/MyAppConfig) as a read only folder. Since it's full of application data, users need to be able to modify its contents without having admin privileges. I can create other folders in the CommonAppDataFolder programmatically, which do not require admin privileges.

How do I set the write privileges for my folder in WiX?

Yan Sklyarenko
  • 31,557
  • 24
  • 104
  • 139
RikSaunderson
  • 3,505
  • 6
  • 32
  • 50
  • The answers to this question may help: http://stackoverflow.com/questions/4272406/wix-how-to-set-permissions-for-folder-and-all-sub-folders – Ferruccio Jul 10 '13 at 09:16

2 Answers2

4

Turns out that the answer looks something like this:

      <Directory Id="MYFOLDER" Name="My folder name">
        <Component Id="MyFolderComponent" Guid="*">
          <CreateFolder Directory="MYFOLDER">
            <Permission User="Everyone" GenericAll="yes" />
          </CreateFolder>
        </Component>
      </Directory>
RikSaunderson
  • 3,505
  • 6
  • 32
  • 50
1

CommonAppDataFolder is a per-machine store and so requires elevated privileges to write to. If you want a per-user store, use the AppDataFolder or LocalAppDataFolder directory properties instead.

Bob Arnson
  • 21,377
  • 2
  • 40
  • 47