Installing a Web Application to an Existing IIS Website using Wix3

[article]

or Even Avoid Using Type 35 Custom Actions": http://blogs.msdn.com/heaths/archive/2006/06/14/be-careful-or-even-avoid-using-type-35-custom-actions.aspx
jhaug09-7small.jpg

3.5    The InstallDirDlg
As shown below, the new application will be installed to a new virtual directory under the picked website root directory plus the new virtual directory if there is any:
jhaug09-8.jpg

3.6    Three Ways about Sequence
The real difficult part is to find out how to properly queue the new dialog and these two Custom Actions in the installation sequence. After tons of reading and experiments, finally I got it work in one way. The right sequence we want is like this:

WelcomeDlg --> Custom Action 1 --> ConfigSFSDlg --> Custom Action 2 --> Custom Action 3 --> InstallDirDlg

  1. Custom Action 1 finds the websites.
  2. ConfigSFSDlg displays the websites, and user picks one of them.
  3. Custom Action 2 finds the picked website's root directory.
  4. Custom Action 3 will set the installation path under the website's root directory.
  5. InstallDirDlg displays the path the new application will be installed to.

    jhaug09-9.jpg

jhaug09-10small.jpg

3.6.1    In the Sequence Tables
We'll queue our Custom Actions in InstallUISequence because we need to provide and get information from the user. You need to add the same into InstallExecuteSequence if you want to provide quiet installation.

Custom Action 1 has to be run before the new dialog ConfigSFSDlg is created. So we will queue this action right before the standard dialog PrepareDlg. The following code put this action in the right place:

jhaug09-111small.jpg

And below is the InstallUISequence table in the result mis file:

jhaug09-11.jpg

3.6.2    In the ControlEvent Table
For Custom Action 2, I found no way to put it in the right place using the same way as the Custom Action 1. So I used another approach: the custom action will be called right after the user picks the website and click the Next button in the ConfigSFSDlg.

You can find a good sample code here regarding this approach: http://www.codeproject.com/KB/install/WIXSSRSInstaller.aspx
jhaug09-14small.jpg

3.6.3    By a Call to Session.DoAction()
Custom Action 3 is called inside the Custom Action 2 with the following code:
Session.DoAction("SetSFSInstallPath2"). SetSFSInstallPath2 is Custom Action 3's name defined in Wix.

All three approaches are well explained in Boneman's Blog here:
http://bonemanblog.blogspot.com/2005/10/custom-action-tutorial-part-i-custom.html

These are three Custom Actions in the result msi file:

jhaug09-13.jpg

4    Add a New Dialog in Wix3
In Wix2, you'll have to make changes in the Wix source code and recompile the Wix2 UI library in order to add a new customized dialog into a standard installation UI sequence. So I ended up with migrating all Wix2 code to Wix3.

Here are two good articles on how to add a customized dialog in Wix3: http://www.dizzymonkeydesign.com/blog/misc/adding-and-customizing-dlgs-i...
http://www.wixwiki.com/index.php?title=WixUI_Custom

Below is an extraction from WixWiKi:
"The stock Wix user interface sequences, UiExtension, do not support inserting a custom dialog. However the underlying dialogs have been carefully constructed such that the navigation logic, the back and next buttons, is not part of the dialog itself. The navigation logic is actually defined as part of the sequence itself. What this means is that you can build your own custom UI sequence using just plain old Wix."

The basic steps are:
1.    Design UI of the new dialog, e.g. ConfigSFSDlg2.wxs, in my example.
2.    Make a copy of a standard user interface, e.g. WixUI_InstallDir.wxs.
3.    Insert your new dialog into UI sequence by modifying the above WixUI_InstallDir.wxs and rename it to, e.g. WixUI_InstallDir_SFS.wxs in my example.
In Wix3, the sequence of dialog is controlled by Event Publishing of Next/Back buttons as shown below.

jhaug09-141small.jpg

Then in your main wxs file, reference your modified UI sequence wxs file as shown below:

jhaug09-15.jpg

 Jirong Hu is a software development consultant specialized in configuration management, build and release management. He has lots

About the author

TechWell Contributor's picture TechWell Contributor

The opinions and positions expressed within these guest posts are those of the author alone and do not represent those of the TechWell Community Sites. Guest authors represent that they have the right to distribute this content and that such content is not violating the legal rights of others. If you would like to contribute content to a TechWell Community Site, email editors@techwell.com.

AgileConnection is one of the growing communities of the TechWell network.

Featuring fresh, insightful stories, TechWell.com is the place to go for what is happening in software development and delivery.  Join the conversation now!

Upcoming Events

May 04
May 04
May 04
Jun 01