Creating an empty folder

Ordinarily, Windows Installer won't let you create empty folders. However, there is a way: Use the CreateFolder element inside an otherwise empty Component element. First, you'll define the name of your empty directory with a Directory element. Follow this example:

<Directory Id="TARGETDIR"
           Name="SourceDir">
  <Directory Id="ProgramFilesFolder">
    <Directory Id="MyProgramDir"
               Name="Awesome Software">
      <Directory Id="MyEmptyDir"
                 Name="Empty Directory" />
    </Directory>
  </Directory>
</Directory>

Here, we've added a new Directory element named Empty Directory inside our main application folder. The next step is to add a component to this directory by using a DirectoryRef element. Notice that we've set the KeyPath attribute on the ...

Get WiX: A Developer's Guide to Windows Installer XML now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.