TeamCity and Web Deploy: Silent unlogged failure

TeamCity and Web Deploy: Silent unlogged failure

C:\TeamCity\buildAgent\work\7f00d1c4099cfbe0\src\TestSite.Umbraco\TestSite.Umbraco.csproj(3364, 3): error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

I was setting up a new TeamCity build server the other day and was writing my first Build Configuration for that build server. On my first attempt to deploy code using MSBuild and Web Deploy, I got the error above.

First, I tried installing the Microsoft Build Tools 2013 in hopes that the correct target would be installed. This did not help us. After installation, the only directory inside of th C:\Program Files (x86)\MSBuild directory was 12.0. We were still missing the \Microsoft\VisualStudio directories.

Next, I tried installing the Microsoft Visual Studio 2012 Shell (Isolated) Redistributable Package. This resulted in the most confusing problem yet. The error I experienced above went away, but I could not deploy my site via web deploy, and there was no error. I observed that a web deploy was never attempted. There were absolutely no logs that shed any light on what I was experiencing. I did a lot of digging and found out that the visual studio isolated shell does not install the Microsoft.Web.Publishing.targets file. This resulted in MSBuild not knowing that Web Deploy existed. When I would pass /p:DeployOnBuild=True, MSBuild would dismiss it as an invalid argument. This StackOverflow post is where I found the solution. It presents several options:

  1. Copy the .target files from your local machine to the build server. This works.
  2. Install the the a full version of Visual Studio 2012 (Visual Studio Express 2012 worked for us).
  3. Install the Azure SDK. Never tried this, but that stack over flow post said it might work. Has anyone tried it yet?


Mark Bowser

comments powered by Disqus
back to top