You first need to do some preparation:
- Set up IIS 6 Management Compatibility (To prevent those "Installation stopped" errors)
- Install Microsoft Visual Studio Installer Projects extension. (To add setup project template to VS)
Then you can create and configure and setup project and run the setup.
Details
1 - Set up IIS 6 Management Compatibility
Open Turn Windows features on or off → Internet Information Service → Web Management Tool and check at least the following items:
- IIS 6 WMI Compatibility
- IIS 6 Metabase and IIS 6 configuration compatibility.
This is to fix the following error:
The installer was interrupted before application could be installed.
You need to restart the installer to try again
2 - Install Microsoft Visual Studio Installer Projects.
This is to add setup project templates to Visual Studio. Here, we are interested in Web Setup Project.
3 - Create and configure the setup project
- Create setup project
- Right click setup project → Add → Project output and choose what you need. You need at least primary output and Content Files from your web project.
Then you can build the project and run setup.exe
.
Note
- You can setup other properties like ASPNETVersion, Manufacturere, product Name, ...
- If after deployment you faced with error complaining about \roslyn\csc.exe, you may want to include roslyn files or remove roslyn compilation at all. For more information take a look at this post.
- You can add
CustomAction
to do some custom actions during install/uninstall. You can find a lot of examples around, like this post.
- You can even customize UI and add some input and use them during installation. You can find a lot of examples around, like this post.
- In general, if your deployment is a common site deployment having a few files and database, a better option is creating Web Deploy Packages and then install the package to IIS. You can automate that process easily.