How to create an MSI Install package for a WCF Web Service

The following was confirmed to work with Visual Studio 2008 in Dec 2009.

1. In Visual Studio, right click on your existing solution and select “add” then “New Project”. Select “Other Project Types” ? “Setup & Deployment” ? “Web Setup Project”.

2. Right-click on your new project and select “Add” then “Project Output”. Select the desired WCF project from the select box at the top, and make sure to select BOTH “Primary Output” and “Content Files”.

3. Build your project

4. Under the debug directory, you will find the generated .msi file.

5. Run the MSI. You can install into a different directory on your local machine to see if it works. I suggest after the install, you open IIS, verify, and in IIS 7 you use the content tab, click right-click “Browse” on one of your .svc files, and make sure it opens correctly in the browser.

Issues:

1. The default IIS Virtual Directory name is the same as your Visual Studio Project name. I’m trying to figure out how to change that …

BONUS:

1. Add a dialog box with four buttons. I named the button “EnvironmentButton”.
Set values of each button to literals such as LOCAL, QA, STAGING, PROD.

2. I created a directory called CustomWebConfigs, with subdirectories called QA, STAGE, and PROD. Each one has a file called web.config. I used this disk structure so the file could always be called web.config and no need to rename it.

3. I did an “add file” for the CustomWebConfigs/Prod/Web.Config and set the “condition” property to: EnvironmentButton = “PROD”

NOTE2: Use only one equal sign, not two! Enclose the value in double quotes.

4. Set TargetName property to “Web.config”
5. Repeat steps 3-4 for each web.config file that you need.

Uncategorized  

Leave a Reply