TeamCity, Umbraco, and Web.config transforms

I'm using TeamCity 8.1.1. Basically, I have an umbraco site (version 7.x.x if anyone thinks that might be relevant). My goal is to set up automated deployment to our dev server. I want TeamCity to watch our git repo, grab changes, build, and use MSDeploy to deploy to the dev site. This is working great on our local setup and for many other sites. This is not working great on our client's server for one particular site. Both TeamCity installs are the same version. Both of the build configurations are basically the same. Both are attempting to build and deploy the same set of code from the same repo.

Here is the error I get when we try to run the build configuration:

[10:02:22]Step 1/1: Build Site (MSBuild) (29s)
[10:02:36][Step 1/1] src\Umbraco\Umbraco.csproj.teamcity: Build target: Build (14s)
[10:02:50][src\Umbraco\Umbraco.csproj.teamcity] AutoParameterizationWebConfigConnectionStringsCore
[10:02:50][AutoParameterizationWebConfigConnectionStringsCore] ParameterizeTransformXml
[10:02:50][ParameterizeTransformXml] C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web\Microsoft.Web.Publishing.targets(2352, 5): Could not open Source file: Could not find a part of the path 'C:\BuildAgent\work\c1d89add5b38ab48\src\Umbraco\umbraco\Xslt\Web.config;\umbraco\Xslt\Web.config'.
[10:02:51][Step 1/1] Step Build Site (MSBuild) failed

Here are the details of the build configuration that is giving me grief:

Artifact paths:
VCS root: <my git repo>
Clean build: false, but I get the same problem with true
Build Step: MSBuild

  • Build file path: my .csproj
  • Working directory:
  • MSBuild version: Microsoft .NET Framework 4.5
  • MSBuild Tools Version: 4.0
  • Run platform: x86
  • Targets: Build
  • Command line parameters:
    • /p:Configuration=MyDevConfig
    • /p:DeployOnBuild=True
    • /p:DeployTarget=MSDeployPublish
    • /p:MsDeployServiceUrl=DevServer/msdeployagentservice
    • /p:AllowUntrustedCertificate=True
    • /p:MSDeployPublishMethod=RemoteAgent
    • /p:CreatePackageOnPublish=True
    • /p:DeployIisAppPath=umbraco_MyUmbracoSite
    • /p:IgnoreDeployManagedRuntimeVersion=True
    • /p:SkipExtraFilesOnServer=True
    • /p:AuthType=NTML /p:UserName=

The .NET project's publish settings is set up to deploy everything in the project folder. I have web.config transforms defined on the sites root web.config where I modify connectionstrings. No other web.config files have transforms defined. No other web.configs are causing any trouble. It is only the /umbrac/xslt/web.config file that is causing trouble. This file IS NOT part of the solution, but it is in the git repo. I suspect that if I added the /umbraco directory to the solution, my problem might disappear, but i want to avoid adding that directory to the solution.

This is another guy who was having my exact problem and appears to have solved it. His method is not idea because I'd have to add the directory to the solution.

Does anyone have any insight? I'm really curious why this issue happens on one TeamCity install but not another. I would feel better if the problem was consistent and reproduceable on other TeamCity instances.


Comment actions Permalink

Ah! I just realized that the TeamCity instances are different versions!
The problems occur on 8.1
I've successfully deployed this site on 8.0.5 and 8.1.1

I'll upgrade the 8.1 to 8.1.1 and see if anything changes.

Comment actions Permalink

Hi Mark,

Yeah, I've seen the same issue.  Adding this line to the .csproj fixed the issue for us.  Make sure you add it for each relevant Configuration:


We also had a similar issue that you might run into if you're excluding the /umbraco/ and /umbraco_client/ and copying those yourself.  The Umbraco NuGet package already includes some targets that do this for us, so we found the copy was happening twice and confusing the piece that locates Web.config files for transform (resulting in duplicates and vague errors).  To fix this, we removed the below line from the .csproj file and used our own methods to copy the Umbraco content:

<Import Project="..\packages\UmbracoCms.7.0.1\build\net45\UmbracoCms.targets" Condition="Exists('..\packages\UmbracoCms.7.0.1\build\net45\UmbracoCms.targets')" />

Hope that helps,

Comment actions Permalink

Tom, I just made some breakthrough. I tried both of your fixes. The first did nothing, and the second broke everything. I think we are working under a slightly different scenario. However, the second solution that brought up nuget helped get me on the right track.

Just found these:

It looks like Sebastiaan just fixed the issue being discussed at: I believe that U4-4510 is the issue that we are experiencing on the USDA server.
The fix is for Umbraco 7.1.0 and Umbraco 6.2.0

We are going to try a nuget update. Hopefully that will solve all of our problems. Looks like this really has nothing to do with TeamCity and everything to do with umbraco, nuget, and webdeploy.

Thanks for the pointers, sir. I'll post back with how it went.
Comment actions Permalink

That does indeed appear to be inteded to fix this problem!  Let me know how it works out.

Strange as one of those steps did definitely fix the exact same issue for us.  Removing those targets should have fixed the issue as Umbraco shouldn't be trying to do anything special after that.  Note that I did forget to tell you  to remove the other line that Umbraco's NuGet install adds:

<Import Project="..\packages\UmbracoCms.7.0.4\build\net45\UmbracoCms.props" Condition="Exists('..\packages\UmbracoCms.7.0.4\build\net45\UmbracoCms.props')" />

...but not sure if that will help.  Note that in our setup, we're telling VS to include "All files in project folder", which you definitely need if you're excluding /umbraco/ from your solution AND have these targets/props removed.

And yes, you're correct that this issue isn't Umbraco-specific.  We tracked it down to a Microsoft bug last time we dug around, but were able to workaround it as I mentioned.


Please sign in to leave a comment.