Setting scriptmaps: step three
We've set two installer properties: REGIISPATH contains the full path name of aspnet_regiis.exe, and SRVRPATH contains the IIS metabase path to the new virtual directory. If any failures occurred, then REGIISPATH is empty.
With this data in hand, it's simple to set the scriptmaps for the site. We add one more standard Custom Action:
| Action |
Type |
Source |
Target |
| SSMCA_SetScriptMaps |
50 |
REGIISPATH |
/S [SRVRPATH] |
... which tells the installer to execute the already installed exe specified by REGIISPATH and pass it the command line specified by the formatted string in the Target field; the "/S" switch followed by our server path. We ensure that this will be executed in the right sequence and under the proper conditions by adding the following to the InstallExecuteSequence table:
| Action |
Condition |
Sequence |
| SSMCA_SetScriptMaps |
REGIISPATH |
6500 |
...which again effectively re-applies the conditions from the earlier sequence entry which set the REGIISPATH property:
REGIISDIR AND NOT (REMOVE OR (ACTION~="ADMIN"))
...indicating that the desired version of aspnet_regiis.exe was found, the installer is not uninstalling, and an administrative install is not being performed. If you watch carefully when you run your modified MSI, you'll see a command interpreter window pop up and display the aspnet_regiis command for a moment near the end of your installation. If you're concerned about suppressing this display, it's possible and is left as an exercise for the reader (try 'start /?' to begin with) but your customers are web server administrators and may not be as disturbed by the command window's brief appearance as a typical user might be.
Now your Web Site Installer project will set ASP.Net v2.0 scriptmaps automatically when the website is installed, and you not only understand how its done but how to troubleshoot any problems which may crop up by gathering verbose installation logs and comparing them to your baseline log file. Errors should be pretty obvious. Please let me know if you find something which needs to be changed.
Next we'll look at the script which performs this modification.