Wednesday, March 21, 2007
Clarius SFT - Wix-based Setup Projects
One of the features SFT provides is support for Wix-based Setup projects. I will show how you can use and extend it to generate a MSI for your guidance package.
Wix-based Setup
When you are creating a Guidance Package with SFT, you can choose to create a VS Setup Project or a Wix-based one as is shown in the following picture:
If you select the Wix-based option, the preview setup project will be unfolded in your solution.Let's take a look at the files that are generated by the wizard:
Setup.wxs: This is probably the most important file because it contains the setup product definition, the directory tree structure, the features (or the feature references), the custom actions for registering the guidance package and the UI definition.
TemplatesContent.wxs/TemplateFeature.wxs: Both files are dynamic, this means that their content of these files will be updated every time you build the Setup Project. They will included every file inside any folder in the guidance package project output directory.
UI.wxs: This contains the UI definition. This is probably the main file you will need to customize to include your own branding.
Strings.wxl: Wix localization stuff file.
MySoftwareFactoryInstaller.config.xml: Guidance Package configuration file. For instance here you can specify here the supported runtime version.
License\License.rtf: The license file for your Guidance Package.
Bitmaps Folder: Image files for the installer wizard branding.
How it works:
The SFT Wix-based project is a standard C# or VB project (depending on what language you choose when you are creating a new MetaFactory solution). It defines the AfterBuild/AfterRebuild targets and the following import:
<Import Project="$(MSBuildExtensionsPath)\Clarius Consulting\Software Factories Toolkit\1.0\MetaFactory\wix.targets" />
The wix.targets file contains the necessary targets to compile (Candle) and link (Light) your wix files in order to generate a MSI for your guidance package. Before that, the WixRefreshContent target is responsible for scanning all the directories in the output folder and updating the content of the TemplatesContent.wxs/TemplatesFeature files.
Customizing the Wix-based Setup Project:
There are some scenarios where you may want to customize the code that the SFT wizard generates for you. The most common scenarios could include:
- Changing the UI branding: You can modify the images in the Bitmaps folder by just overwriting them. You can also customize the Dialogs order, descriptions, colors, etc just editing the UI.wxs or Strings.wxl files.
- Adding dependencies: If you need to include more than the Guidance Package and Guidance Package Installer assemblies, you can add them in the Setup.wxs file just adding a <File> element inside an existing directory or you could even create your own new directory structure.
- Launch Conditions: If you Guidance Package will relies on some other software components that must be installed in the target machine, you can add Wix Launch Conditions in the Setup.wxs file.
I hope this post help you to understand the SFT Wix-based Setup Project structure, how it works and how you can easily customize it with a low effort. If you have any questions about this or other features in SFT you can visit the following sites/forums:
Guidance Automation.Net: http://www.guidanceautomation.net
SFT: http://www.softwarefactoriestoolkit.com/
Enjoy!