Deploying Orchard to Azure Web App using TeamCity

Stas Demchuk

by Stas Demchuk on 10/07/2015

Deploying Orchard

Our team wanted to setup continuous deployment of .NET (Orchard CMS) project to Azure Web App container. I was trying to emulate the behavior of publishing the project from Visual studio using "Publish" button. Here's the screenshot of a build config I ended up with:

Build configuration

First of all, if you're not planning to run any tests before publishing the app, this will be a one-step build.

You should specify Orchard.Web.csproj as the build file. Orchard.proj and Orchard.sln might throw exceptions about missing files.

Version of MSBuild pretty much doesn't matter. I tested it on v11.0 and v12.0, both worked without any issues.

The key part in getting the "Success!" message during the build is passing a proper msbuild command to the command line parameters. First of all, to emulate the behavior of publishing a project from Visual Studio, you need to pass /p:DeployOnBuild=true as a parameter. Still, the project will not be deployed until you pass another parameter, /p:AllowUntrustedCertificate=true. You'll just keep getting "Skipping unpublishable project" message after the project is built successfully.

You'll also need a publish profile for MSBuild to know where to deploy to. The problem here is MSBuild doesn't understand .PublishSettings files. You'll need to import that file into Visual Studio and then use the appropriate .pubxml after another small modification. .pubxml doesn't store the raw password value, so you'll have to copy the password from userPWD attribute in .PublishSettings and put it as a value of <Password> node in .pubxml.

That's it! You should have no problems deploying Orchard from TeamCity.

Have any specific issues you need help with? let us know in the comments!