Usually customer begins acquaintance with new program by installing it. The first impression is very important therefore program installation must be smooth and easy. Most ASP.NET applications do not have installers, but we want to have one. I would like to share our experience with installation developing in this article.
First thing we should do is writing of installation scenario for our program. For first version of TP 2.0 it is quiet short and simple:
- 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
Uninstall option required as well (all except database).
To make such installation we decided to use NSIS (Nullsoft Scriptable Install System). The reasons were following:
- It is free (powerful installers cost about $1k per one title)
- It is script-based and allows changing installation scenario freely (while standard Microsoft solution is Data Driven and do not allow many things)
- There are lot plug-ins and examples for NSIS
Full source code of installation script for TP2.0 is here. Code completely covers scenario described above. Developing of this code (including research) took about 3 working days.
The following links were useful: Forum: http://forums.winamp.com/forumdisplay.php?s=&forumid=65 XML Plugin: http://nsis.sourceforge.net/XML_plug-in Create Virtual directory: http://nsis.sourceforge.net/Setting_up_a_virtual_directory
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.