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 component to yes
, as there will be no file to serve this purpose.
<DirectoryRef Id="MyEmptyDir"> <Component Id="CMP_MyEmptyDir" ...