windows-installerweb-setup-project

Visual Studio MSI Installers


I have an Web Setup Project Installer and I would like to default the site and the Application Pool that is selected during the install process. Also I would like to have the name of the product append the current version number during the build process of the installer.

Any help would be greatly appreciated! Thank you


Solution

  • The Visual Studio Web Setup Project is quite a simple (and not too flexible) tool. You have some options, though (assuming you are not ready to switch to using something more flexible such as WiX or a commercial installation packaging product).

    Modify the MSI After Building

    One way to do what you want is to modify the MSI file after it has been built.

    You can add properties such as the following:

    1. Add a property named TARGETSITE and set it to the metabase path of the site you need to be the default. For example, /LM/W3SVC/2.

    2. Add a property named TARGETAPPPOOL and set it to the name of the application pool you need to be the default. For example, MyAppPool.

    3. You can also set the product name by editing the existing ProductName property.

    Making changes to MSI files can be achieved manually with tools such as InstEdit or ORCA (which is part of the Windows SDK).

    Alternatively, you can create/find MSBuild tasks to get and set properties in MSI files. This gives you a nice way to automatically make the desired changes during automated builds.

    Invoke with Commandline Arguments

    More simply, you can invoke the installation from the command-line using msiexec.exe and specifying values for the TARGETSITE and TARGETAPPPOOL properties, for example:

    msiexec /i MySetup.msi TARGETSITE=/LM/W3SVC/2 TARGETAPPPOOL=Pool2
    

    You can't mess about with the ProductName this way, though.