A task is simple: release my site to IIS. Web Applications can be released through several ways. Usually it is better to choose web deploy. Web deploy is a good technology, but in my opinion it has a lack of simple tutorials as well as VSTS. I spent plenty time trying to set up web deploy in VSTS without any results. After couple attempts I just forgot about that and continue to deploy my apps from Visual Studio. However, yesterday I had to deploy a new app, and googled it again. What is good that I found out that the Microsoft is about to release new features of VSTS to easier IIS App Deployment. I got crazy and started new setup for my project. Only after few steps over I read this:

This is a preview feature that is only available to some accounts in Team Services.

Damn. But half of those features is already published in preview and you can use it.

Publication process in VSTS has two parts: build and release.


There are should be only compiling and preparing steps in the build part. There are no any copying to target machine or modification actions. In other words it must be a batch of jobs which can be run as many as possible times and in the you environment nothing is changed. Web Application building to zip package when using web deploy. What is released by the Microsoft is ASP.NET build template.

This template contains regular C# build steps but with required parameters to build deploy zip package. It should be Build Solution step with following MSBuild arguments:

/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)\\"

For builds I use a local agent and a local file share. You can set up Copy and Publish Build Artifacts to copy zip package to share. My share address is $(sharename)\$(Build.DefinitionName)
where $(sharename) = “\\my\share” and $(Build.DefinitionName) is built-in variable. All variables list you can find here
If you have only one artifact, you can trick agent and put in Artifact Name $(Build.BuildNumber). In that case your builds will be in the next path:

That’s it. Your build is ready to deploy.


Since our package is ready we’re behind two steps to deployed app:

  1. create and run site and app pool – WinRM – IIS Web App Management
  2. publish our app – WinRM – IIS Web App Deployment

Step 1 – setup app pool
Machines: our target server name
Admin login and pass – your credentials.
Http or Https switch – ssl connection can be chosen to use to publish sites in public networks. But in local network http protocol is fine.
Website settings group: setup your site properties.
Application Pool: your app pool properties.

When this properties are configured, when you release your app, you should have configured and started application app pool with application which is using this pool.

Step 2 – deploy our app
Machine – our target server.
Admin login and pass – your credentials.
Actually, I use variable to put it in both places.

Deployment settings group
Web Deploy Package – full path to your zip package. If your are using VSTS share $(System.ArtifactsDirectory). When you are using local share, you should specify particular path to you zip package. For instance, my setting is:


You can see that I use artifact variable – $(Release.Artifacts.mysite.DefinitionName). VSTS allows to use multiple artifacts as release source. Moreover, there are a lot of variables for release, list of them can be found here
Same settings to Parameter file:
Web Deploy Parameter File:

That’s all. Just push and you will get you site published.