I mentioned service versioning briefly in my Are you Release Ready? post two weeks ago as one of the ways you can avoid breaking existing customers of a web service. Many developers assume we have an elaborate and complex service versioning system. We do not. Its very simple, we add a new application under an IIS site for each new service version.

You do have to be diligent in working with consumers to update to later versions so you can eventually retire the old versions. But overall we have found this to be VERY effective in allowing the services team to work ahead of their consumers safely. Best of all this was easy to implement! At this point we never update services in production anymore instead we deploy a new version.

The Delivery Pipeline

The question was how do we build this into our delivery pipeline? Turns our with WebDeploy this is really easy. WebDeploy already allows you to set the IIS site name and it has the capability of creating applications under an IIS site. So all you have to do is set the DeployIisAppPath MSBuild property to change the WebDeploy package default site/app name.

<PropertyGroup> <DeployIisAppPath>Default Web Site/V_1.1</DeployIisAppPath> </PropertyGroup>

You can add this in your .csproj file but it is much more visible to use a [projectName].wpp.targets file. When when you are ready to deploy a new version simply change the version number and redeploy to create a new application under the root site.

You can also create a project for the root site if you need to manage a shared configuration file or other files.

You will need to add an additional MSBuild property ( SkipExtraFilesOnServer ) to ensure the root deployment doesn’t delete the service version applications. By default WebDeploy cleans the folder of files not deployed during the deployment.

<PropertyGroup> <DeployIisAppPath>Default Web Site</DeployIisAppPath> <SkipExtraFilesOnServer>True</SkipExtraFilesOnServer> </PropertyGroup>

Checkout my Github account for a working sample of this solution.

If you found this post useful or have questions please let me know in the comments or on Twitter. Cheers!