Categories
How-to Microsoft Tools Windows Installer, Application Compatibility and Deployments

Creating your first WiX project

The Wix tools allow you to define the structure of a windows installer package using an XML file. This gives you all of the usual benefits of XML: easy editing with a variety of tools, the ability to modify the files using well-known technologies, and the ability to put the source file under source code control, for ex. the Wix tools themselves are command-line tools, so they fit well with almost any build process. In this post, we will look at creating a WiX project using Visual Studio.

A little note on MSi Engineering
Windows Installer setup package can be described as a three-level hierarchy. The product is at the top of that hierarchy. Users can interact with a Windows Installer setup package at the product level, as during a default or typical install, or they might interact with the setup package at the features level, as during a custom install. Developers, on the other hand, have to interact with the setup package at the component and individual resource level.

Packages are built from components. A component is a group of one or more related resources—files, shortcuts, registry entries, etc.

Components are grouped into features. A feature is a group of one or more components that are installed together. A component can belong to one or more features, but each component is installed only once on a give machine.

Every Windows Installer product, package, and component is identified internally by a unique GUID. The product code GUID remains constant for all releases within the same major version of a product. The package code GUID changes for each build that is released into the wild. The component code GUID changes according to the rules governing components.

For more information on Component Rules Click Here

Starting a WiX project in Visual Studio

Step 1: Launch Visual Studio, and create a new project.

Step 2: Select Setup Project, Windows Installer XML Section

Step 3: Your first Wix Script and template is ready, you will get intuitive help when you start typing – Thanks to Votive

Explaining WiX script Elements

The product element defines the product that the installer will install. The name of the element corresponds to a table in the windows installer database, and the attributes correspond to the columns in the table. For instance, the installer database includes foreign key columns to relates many tables, while the WiX source files use nesting to accomplish the same relation. The WiX tools take care of defining the appropriate foreign key values for you.

–Package Id=”6697CCC3-B351-4DCE-820E-DEAC87F57A2A” Comments=”Demo Installer” Manufacturer=”Msigeek.com” InstallerVersion=”200″ Languages=”1033″ Compressed=”yes”

Within the product element, you’ll find a single package element, defining the package that corresponds to this WiX file.

–Media Id=”1″ EmbedCab=”yes” Cabinet=”test.cab”

The media element defines the distribution media where the MSI file and any associated CAB files will be stored.

The directory elements define the hierarchy of directories that the installer service will use with this software. Note that the Id attributes are not completely arbitrary. The windows installer defines a number of special directories, including the two (the program files folder and the program menu folder) that I’m using in this example.

The Component elements and their child elements define the exact software that will be installed. In this case, the first component consists of a single file, while the second includes a file and a shortcut to the file. Note that WiX will look for the files that you include relative to the XML file. The best plan is probably to place the XML file in the same folder as your source files, and place the wix tools on your path.

The feature element defines both the single feature in this package and the mapping between features and components.

One will need both the Windows Installer SDK and the WiX documentation to develop Wix Scripts and MSis.

Categories
Microsoft Tools Windows Installer, Application Compatibility and Deployments

WiX v3.0 now available for download

The final build of WiX v3.0 is 3.0.5419 has been released to SourceForge and marked RTM/stable. You can download it from http://sourceforge.net/projects/wix/files/.

Also, Votive is now available for Visual Studio 2010 beta. I would suggest all Visual Studio 2010 Beta users to upgrade to the latest build of WiX v3.5 to try out the feature. You can download it from http://wix.sourceforge.net/releases/3.5.0605.0/.
You also get,
A new set of detection properties for .NET Framework 4 beta installation states in the WixNetfxExtension
A new set of detection properties and registration custom actions for Visual Studio 2010 beta editions in the WixVsExtension.

Call to Actions
Votive – http://wix.sourceforge.net/votive.html
WiX v3.0 online documentation – http://wix.sourceforge.net/manual-wix3/main.htm
Rob Mensching’s announcement about the release of the final version of WiX v3.0 – http://robmensching.com/blog/posts/2009/7/4/WiX-v3.0-released
Tips to migrate from wix v2 to wix v3http://robmensching.com/blog/posts/2009/7/7/Tips-on-how-to-upgrade-from-WiX-v2-to-WiX-v3
Bob Arnson’s announcement – http://www.joyofsetup.com/2009/07/04/wix-v3-0-has-been-released/
WiX site on SourceForgehttp://wix.sourceforge.net
WiX tutorialhttp://wix.sourceforge.net/tutorial.html
Clickthroughhttp://wix.sourceforge.net/clickthrough.html

Folks, who aren’t aware about WiX….
The Windows Installer XML (WiX) is a toolset that builds Windows installation packages from XML source code. The toolset provides a command line environment that developers may integrate into their build processes to build MSI and MSM setup packages.

WiX is an open source project, originally developed by Microsoft and maintained by Rob Mensching. You can download the latest binary and source code releases from SourceForge. This tutorial originally describes version 2.0, the stable release. Version 3 is still under development and although it is still a moving target, we have started to add material that describes the changes brought about by the new version.

The toolset is written in C# and requires the .NET Framework 1.1 and its Service Pack 1 to run. However, this only applies to the toolset itself. The installation packages you create with the toolset do not require any extra framework or software to be installed on the target computer. Similarly, there might be a few additional utilities required for some special applications (merge modules, patches) but only on your build computer, the client will only need the finished and self-contained installer package, nothing else.

Join WiX Group:
There is a friendly community of Wix developers and users in a dedicated mailing list, hosted at SourceForge. This is the best place to ask for advice about any aspect of WiX. If you already have a SourceForge account, you can join on the website, too, but the simplest way is to send an empty message to the subscription address.