Installation Instructions

FAQ

Online Documentation

How to Track the Time You Spend Online

Blog Entries

June 26, 2006: Using Inno Setup with the .NET Framework

more...

June 23, 2006: The Idea Behind TimeSprite

more...

Using Inno Setup with the .NET Framework

This article describes the script used to automatically download and install the Microsoft .NET Framework during the TimeSprite installation. Developers of .NET applications may find this information useful for their own applications.

The script is based heavily on the script Ted Ehrich posted to the Inno Setup newsgroup in this post: http://news.jrsoftware.org/news/innosetup.isx/msg06108.html

The script uses some of the third party add-ons to Innosetup, I think the QuickStart Pack includes what you need.

Requirements

Having the .NET Framework as a dependency makes the installation requirements somewhat complex.

The Script

The script that I ended up with performs the following processing:

  1. Requires Windows 98 or Windows NT4 or later. For simplicity it does not check for the required NT4 service pack or Internet Explorer 5.01 - I don't think many systems that back level will be installing new software. However in testing I did verify that if the version of IE is too low, the .NET Framework installation asks for it to be upgraded.
  2. If the .NET Framework is not installed and the user is not logged on as an administrator, it tells the user they need an administrator to install the .NET Framework.
  3. If the .NET Framework is not installed, it looks for the dotnetfx.exe file in the same location as the setup file. If it is not found, it downloads it from Microsoft.
  4. Installs the .NET Framework if required.
  5. If the .NET Framework installation was successful or it was already installed, installs the application.

I haven't programmed in Pascal, and this was my first shot at an Inno Setup script, so there are probably plenty of opportunities for tidying things up. A lot of what I did was just copying and modifying stuff. However the end result does seem to handle the .NET installation nicely.

Here is the script: dotnet.iss

Notes:

Unrelated but perhaps useful information

I also have a digital photo program, Picnam, which I converted to the same process. Picnam adds entries to the "Open With" menu in Explorer, so that people can easily open images using Picnam but existing file associations are not affected.

These are the registry entries I used:

[Registry]
Root: HKCR; Subkey: ".jpg\OpenWithList\MyApp.exe"; Flags: uninsdeletekey noerror
Root: HKCR; Subkey: ".jpeg\OpenWithList\MyApp.exe"; Flags: uninsdeletekey noerror
Root: HKCR; Subkey: "applications\MyApp.exe\shell\open\command"; ValueType: string; ValueData: """{app}\MyApp.exe"" ""%1"""; Flags: uninsdeletekey noerror

Root: HKCU; Subkey: "Software\Classes\.jpg\OpenWithList\MyApp.exe"; Flags: uninsdeletekey
Root: HKCU; Subkey: "Software\Classes\.jpeg\OpenWithList\MyApp.exe"; Flags: uninsdeletekey
Root: HKCU; Subkey: "Software\Classes\applications\MyApp.exe\shell\open\command"; ValueType: string; ValueData: """{app}\MyApp.exe"" ""%1"""; Flags: uninsdeletekey

The HKCR values install the "Open With" option for all users, but fail if the user is not an administrator. The HKCU values install it for the current user, and work even if the user is not an administrator.

VMWare

I used VMWare Workstation for the first time in testing the setup process, and I have to say it is a huge productivity booster for this type of thing. Using snapshots I was able to run the installation process with minor changes in various configurations over and over again - probably about 20 times in a couple of hours. It was a huge productivity gain, and I join those who say that VMWare or an equivalent product is an essential tool for software development.