Ice, Ice, Maybe (part 2)

I finally figured out why help is skimpy on Wix (the Windows Installer XML toolkit): that’s mainly because the original designers of Wix don’t want you to use Wix. It’s that simple: Wix’s learning curve is so steep, I wouldn’t even recommend it if you’re not willing to spend time at it. Additionally, don’t bother looking for sample templates (that is if you can find them) or help for the cryptic warning and error messages.

On the good side, there are a couple of good tutorials that should give you some leeway in your custom install script: There’s Gábor DEÁK JAHN’s (excellent) basic tutorial on Wix, which is probably the first site you should take a look at. Additionally, for more advanced application and use of Wix, you should probably check out Alex Shevchuk’s pages: his articles are highly technical and you may actually pick up some stuff regarding the inner workings of Microsoft’s Setup Installer SDK.

Anyway: if you just figured out that you need to add an additional data directory to your application setup program and you ran into a roadblock of cryptic messages (don’t bother going in here if you’re not interested):

The trick is simple according to the manual: Add an extra Directory entry in your main DirectoryRef tag. In the sample below, I decided to use the Local App Data folder as my main data directory (which is the preferred way in Windows XP/Vista):

  • In Wix, the User’s Local App folder is identified by the id “LocalAppDataFolder” (for a complete list of SystemFolders you can use in Wix check out this MSDN article).

  • Create another nested Directory entry inside of this with an arbitrary id (Uppercased) and the actual folder name.
  • Move the components and file entries in this nested directory (don’t forget to create GUIDs for them).
  • Add a CreateFolder entry (you can basically leave the name blank because it will take over the name you set in the parent’s entry.
  • Add a dummy RegistryValue entry (required).
  • Add a RemoveFolder entry and reference the LocalAppDataFolder entry.

Below is sample code how I did it for Convendro:


<Directory Id=”LocalAppDataFolder” Name=”LocalFiles”>
<Directory Id=”LOCALAPPFOLDER” Name=”Convendro”>
<Component Id=”MyDataFiles”
Guid=”C0EAC254-0185-458B-98DD-DABFD8ABB2F1″
DiskId=”1″>
<File Id=”CommandsFile” Name=”cmddesc.xml”
Source=”..\convendro\bin\Debug\cmddesc.xml”/>
<File Id=”PresetsFile” Name=”presetsdata.xml”
Source=”..\convendro\bin\Debug\presetsdata.xml”/>
<File Id=”ReadmeFile” Name=”ReadMe.txt”
Source=”..\convendro\bin\Debug\ReadMe.txt”/>
<CreateFolder />
<RegistryValue Root=’HKCU’
Key=’SOFTWARE\ArthurHoogervorst\Convendro’
Type=’string’ Value=’INSTALLED’
KeyPath=’yes’ />
<RemoveFolder Id=”LocalAppDataFolder”
On=”uninstall” />
</Component>
</Directory>
</Directory>