How to set scriptmaps in a Web Setup Project

Web Setup Projects make it simple to package and deliver a web application, but they have some drawbacks.  One often mentioned is that the new website's scriptmaps are not necessarily set to ASP.Net 2.0, rendering the website unusable.  Setting the scriptmaps from the command line or the IIS UI is not difficult if you know how, but it's not simple to discover or to remember.  The behavior seems inconsistent; on some machines you never have to perform this step, on others you do.  Why not have the installation MSI file set the scriptmaps for you?

The Web Setup Project doesn't seem to give the user much control over Custom Actions or the InstallExecuteSequence, and no one want to introduce manual steps to setup production.  Yet there's a simple solution.  The Windows Installer API includes a comprehensive object model for the MSI file, and the Web Setup Project features a project property named PostBuildEvent.  This makes it simple to execute a script on completion of a build, and the script can insert all the MSI elements required to set the scriptmaps when the installer runs.

There's a lot to explain about this process, so I'll begin by just posting the scripts and telling you how to use them, and then I'll go on to explain the details in future posts.  Perhaps your feedback will help improve the process before I'm far down the road.

Quick Start

  1. Download the attachment Scripts.zip and extract the files AddSetScriptMaps.wsf and SetSrvrPathCA.js.
  2. Place the two files in the same directory located anywhere; in your project or, say, on a share like  \\FileServer\Development\Scripts\WebAppSetup\ScriptMaps\.
  3. Open your existing Web Setup Project, select the project node, and right-click-select "Properties."
  4. Select the PostBuildEvent property and set its value to:
    CScript "\\FileServer\Development\Scripts\WebAppSetup\ScriptMaps\AddSetScriptMaps.wsf" "$(BuiltOuputPath)".
  5. Build your Web Setup Project.
  6. View the Output window and verify that the build output ends with "MSI successfully updated for registering scriptmaps."

That's it!  When you run your new MSI to install your web application on a server, it will set the new web application's scriptmaps to v2.0.50727.

It's going to take a bit of effort to explains how the script works.  Instead of writing one marathon posting, I'll cover this in the next few installments.  I'm definitely interested in your feedback, as well as any other Web Setup Project wishes you might have.

Published 09 September 06 06:44 by vank
Attachment(s): Scripts.zip

Comments

# BradleyB's WebLog said on September 11, 2006 2:27 PM:
Van Kichline has started a series of blog posts documenting how to extend web setup projects.His first
Anonymous comments are disabled

Search

Go

This Blog

Syndication

Page view tracker