If you don't want the user to change the virtual directory you can simply remove the "Installation Address" dialog from the User Interface.
- Right Click installer project and
select "User Interface".
- Expand the "Start" node.
- Right click on "Installation Address".
- 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.
- Remove the Welcome Page.
- Add a Textboxes dialog (for example "Textboxes (A)")
- Change Visible properties for all the textboxes to false so no textboxes are shown.
- Change the BannerBitmap and BodyText property so it looks somewhat like a welcome
page.
- 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.
Right click on solution --> Properties
Look under Common Properties --> Startup Project
Select multiple startup projects
select Start action on the projects you need to debug.
Best Answer
The way to do it is to create a class derived from
System.Configuration.Install.Installer
. Override theInstall()
method. The following is an example that changes permissions on a directory and a file, you probably don't want to be so permissive, but it depends on your security context. In order for this to work, the setup project has to run this as a custom action. Add the "Primary Output" from whatever project this class is in. You will also need to pass the directory to the custom action in its properties. The first variable name has to match the code. Like this:/targetdir="[TARGETDIR]\"