How setting scriptmaps works
An MSI contains a database which directs the installation, uninstallation, rollback and repair of a set of files and registry entries. The database contains a number of tables, and the AddSetScriptMaps script adds entries to five of them:
- The AppSearch table gets an entry which looks for the appropriate aspnet_regiis.exe.
- The CompLocator table gets an entry describing how to find aspnet_regiis.exe.
- The CustomAction table gets three new Custom Actions:
- One creates the full path to aspnet_regiis.exe.
- One reformats a string from something like "/LM/W3SVC/1" to W3SRC/1/ROOT/"
- And the workhorse, which runs the appropriate aspnet_regiis.exe with the proper parameter.
- The Binary table gets an entry containing a simple Custom Action written in JScript.
- The InstallExecuteSequence gets three entries (with conditions) which select and sequence the three Custom Actions.
Once these rows are added to the tables, aspnet_regiis is executed and sets the scriptmaps for the newly created website each time the MSI is executes to perform an installation. Normally Custom Actions need to be careful to undo their work on rollback and uninstall, but in this case these actions remove the virtual directory that the scriptmaps are set for, thus effectively undoing this action for us.
Next we'll go into some detail about each entry, and finally we'll cover how the script modifies the MSI and why it's organized the way it is.