Creating Windows Installers: Deploying Monorail Web Applications

I recently built a small Monorail application and used my Wix-fu to build an installer and I wanted to share. Not really much to add to my previous post about building installers for web applications except that when you are deploying a Monorail (rc3) application you need to register the .castle extension as something that IIS should care about. This is pretty easy to do. Take a look at this snippet of Wix XML:

Adding a handler for an ISAPI extension to the web application is just a matter of telling Wix about where it is. The ASP.Net ISAPI extension lives at the root of the .Net framework’s folder. The first thing we do is use a <RegistrySearch> to find where the .Net framework lives and put that information into a property.

<Property Id=”NETFRAMEWORKROOT” Secure=”yes”><RegistrySearch Id=”NetFrameworkRoot” Root=”HKLM”
Key=”SOFTWAREMicrosoft.NETFramework” Name=”InstallRoot” Type=”raw”/></Property>
<Component Id=”pleatsIIS” Guid=”{CE3B5E68-648C-4740-962A-3756AFF7320A}”><WebVirtualDir
Id=”,/br>pleatsVirtualDirectory” Directory=”INSTALLDIR” Alias=”pleats” WebSite=”DefaultWebSite”
><WebApplication Id=”pleatsWebApplication” Name=”Pleats Monorail”><WebApplication
Extension=”castle” CheckPath=”no” Script=”yes”
=”[NETFRAMEWORKROOT]v2.0.50727aspnet_isapi.dll” Verbs=”GET,HEAD,POST,DEBUG”
/><WebApplicationExtension Extension=”aspx” CheckPath=”yes” Script=”yes”
=”[NETFRAMEWORKROOT]v2.0.50727aspnet_isapi.dll” Verbs=”GET,HEAD,POST,DEBUG”

Monorail needs web requests having a .castle extension to be handled by ASP.Net. The <WebApplicationExtension> tag will do that for the web application we are creating. You may notice that I am also registering the .aspx extension as well. My project has a default.aspx that was created by Monorail project template to redirect users to the default controller action. It seems that if you register one extension you override all the default extensions that are normally added to the web application. If you specify one extension you must specify all the ones you want to use.

You may notice that this Wix XML is coupled to the .Net 2.0 framework. If your user only has .Net 3.0 installed I believe that this installer would not work.