Using NSIS to Install an ASP.NET Web Application to IIS

One of the main projects I have been working on recently has been a .Net 3.5 web project.  While I have always liked the agile development and IDE which .Net and Visual Studio provide, The Setup Project template (which creates MSI installation files) has always been hard to use, difficult to customise and very restrictive.

In the past, I’ve used the NSIS (Nullsoft Scriptable Install System), which:

… is a professional open source system to create Windows installers. It is designed to be as small and flexible as possible and is therefore very suitable for internet distribution.(http://nsis.sourceforge.net).

However, despite the great number of resources and example scripts to do anything you can pretty-well imagine, a simple straight up installer script to modify IIS using NSIS to install the web application seems to be quite a challenge.

I did, however, stumble across a blog faced with a similar issue, wanting an installer system to perform the following tasks:

  • Show ‘Hello’ page
  • Ask to select virtual directory name and installation folder
  • Ask about database connection string (user name, password etc)
  • Copy working files to destination folder
  • Create Virtual Directory
  • Create Database
  • Show ‘Installation complete’ page
  • Open installed application in web browser

They provided an example script which I repost here should the direct link ever go down.  They do mention on their blog a number of future enhancements missing from the installer script:

There are many things should be improved in installer. First is improvement of virtual folder creation. User should have possibility to choose between different virtual servers. Also correct default installation directory should be suggested (now it hardcoded as “C:\Inetpub\wwwroot\TargetProcess2”). Installer should detect if .Net 2.0 is installed and help to download and install it. Installer should upgrade old version of TargetProcess to new.

Given that I have quite a bit of experience with NSIS, I think those points should be mostly trivial and I will be sure to post the updated example script to this blog once it’s complete.


UPDATE
This url http://weblogs.asp.net/krobertson/archive/2004/04/01/106002.aspx looks promising, not exactly what I want to do but a useful reference never-the-less.

Leave a Reply

Your email address will not be published. Required fields are marked *