Virtual Directory in Web Setup Project

web-setup-projectwindows-installer

I have a web setup project which by default shows the virtual directory in the textbox installer screen. I wish that the virtual directory name cannot be edited by the user and always defaults to the one I have setup in my msi. How can this be achieved?

Best Answer

If you don't want the user to change the virtual directory you can simply remove the "Installation Address" dialog from the User Interface.

  1. Right Click installer project and select "User Interface".
  2. Expand the "Start" node.
  3. Right click on "Installation Address".
  4. Select "Delete"

If you want different parameters for the Web site, virtual directory, application pool that is normally selected by the installation address dialog you can override with a custom action as others have described.

However, in my experience custom actions do not help with setting defaults that the user can change because they execute After the dialogs that ask for user input.

The easiest way to set some defaults that the user can override if necessary in a dialog is to do the following.

  1. Remove the Welcome Page.
  2. Add a Textboxes dialog (for example "Textboxes (A)")
  3. Change Visible properties for all the textboxes to false so no textboxes are shown.
  4. Change the BannerBitmap and BodyText property so it looks somewhat like a welcome page.
  5. Set the necessary properties you want to override in the "Edit***<n>Property" and set the default value in the "Edit<n>***Value".

The most useful properties (IMHO) are.

TARGETDIR - Where the files are to be copied.
TARGETVDIR - The Virtual Directory to be created in the specified site.
TARGETAPPPOOL - The application pool to use (NOTE: This must exist, it won't be created)
TARGETSITE - The website where the virtual directory is to be created (NOTE: This is the metabase value for the web site... For example: "/LM/W3svc/2". Also note that the site must exist).

There is a full list of properties for the installer can be found here.

If you really want better control over the IIS setup I would suggest changing your project to a standard Windows Installer project and creating custom Install actions so that you can programatically create AppPools. A good place to start to understand programmaticly creating these things is here.

The biggest reason for doing it this way is that custom actions run after prompting but the app pool and web sites must be created before the installer can prompt.