Create folder inside C:\ProgramData using WIX installer and deploy few configuration files in that folder

Nikhil Arackal Sivadas picture Nikhil Arackal Sivadas · Jun 9, 2016 · Viewed 9k times · Source

i tried with following code, But ProgramData folder is not getting created while installing. My requirement is to install some files in install directory provided by user and deploy few configuration files in ProgramData folder(C:\ProgramData\COMPANYNAME\APPNAME). Code is given below. Can anyone help me to identify the issue? or another solution to achieve this.

 <Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder">
        <Directory Id="INSTALLFOLDER" Name="APPNAME" />
      </Directory>

      <Directory Id="CommonAppDataFolder">
        <Directory Id="CommonAppDataManufacturerFolder" Name="COMPANYNAME">
          <Directory Id="MyAppDataFolder" Name="APPNAME">
          </Directory>
        </Directory>
      </Directory>
    </Directory>
  </Fragment>

Answer

Brian Sutherland picture Brian Sutherland · Jun 9, 2016

You need a feature containing a component installing into the MyAppDataFolder directory for the installer to implicitly create the folder during installation. With no component installing there the folder won't be created.

Just defining a Directory structure is not good enough to get those folders to be created.