For my current project, I've had to create installation packages with WiX, an opensource tool that allows to create very powerfull installers with XML.
I've used the 2.0 version before, but now there is a beta of the 3.0 version, called Votive, which (at last) includes project templates for Visual Studio 2005 and IntelliSense support (quite handy!).
After using it for various things (copying files to System32 folder, Program files, editing registry and XML configuration files, getting environment variable values...), I've found that it still lacks some good info, so I hope with this post things will be easier at last for those wanting to do similar tasks with this tool.
This are some tutorials I looked at while using WiX:
- WiX Tutorial: The best one. Now with the Votive version some things are different but is still the best source to learn WiX.
- Introduction to WiX: An official tutorial. Nothing impressive, but useful to look at the schema elements.
- Votive: A small overview of the Votive VS integration features.
If the WiX templates don't show on the New Project window, open a VS Command-Prompt and type "face="Courier New">devenv.exe /setup".
A nice tool to build the setup GUIs is WiXEdit, but don't expect to replace editing XML... just helps with the visual part.
If you want to edit XML files (for example to setup things in the Web.config file), with Votive you have to:
- Add a reference to WixUtilExtension.
- Add xmlns:util="http://schemas.microsoft.com/wix/UtilExtension" to the <Wix> tag namespaces.
- Use <util:XmlFile> instead of just <XmlFile> to have the tag recognized.
- Add a localization file with this four <String> Ids: msierrXmlFileFailedRead, msierrXmlFileFailedOpen, msierrXmlFileFailedSelect, msierrXmlFileFailedSave
Windows Installer has some common standard actions/events you can control under WiX. Remember that you can't modify a file before copying it to the destination first
You can specify special Windows folders (like <DirectoryId="ProgramFilesFolder">) looking at this table.
If you want to execute something you've installed (not the main program), here's one method to do it:
<CustomActionId='OtherExecution'FileKey='ExecuteSomething'ExeCommand=''Execute='deferred'Return='check' />
<InstallExecuteSequence>
<CustomAction='OtherExecution'Before='CreateShortcuts'>NOT Installed</Custom>
</InstallExecuteSequence>
<FileId='ExecuteSomething'Name='Notepad.exe'DiskId='1'Vital='yes'Source='...' />
And finally, a list of Locale IDs (LCID) can be found here.
Tags: Development