26 September 2010

Continuous integration MSBuild and Framework 4.0

I use TeamCity as my integration server and got it working sweetly after some fiddling and help from Doug Rathbone's great post (thanks Doug). Then I wanted to use the Visual Studio 2010 Web Deployment Project to get it copied to my web server box after the build. I anticipated problems and of course they came thick and fast in the form of things like:
  • The specified task executable location "bin\aspnet_merge.exe" is invalid.
  • The specified task executable location "C:\Program Files\MSBuild\Microsoft\WebDeployment\v10.0\aspnet_merge.exe" is invalid.
  • The "CollectFilesinFolder" task was not found. Check the following…
  • The "Microsoft.WebDeployment.Tasks.AspNetMerge" task could not be loaded from the assembly…
etc. etc. I started to work through them one by one but I found the answer was to install the SDK and copy the .target files:
  1. Install windows SDK on your build server. Use web installer and unchecked everything except for ".NET Development Tools" depending on your target framework (version/framework):
    6.1 at
    or 7.1/3.5 at
    or 7.1/4.0
  2. Copy the files from your dev box:
    C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web
    C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\WebApplication
    to the equivalent paths on your build server.
  3. You'll also need to adjust the location of your ASPNet merge path so on the build machine edit:
    C:\Program Files (x86)\MSBuild\Microsoft\WebDeployment\v10.0\Microsoft.WebDeployment.targets
    to C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\NETFX 4.0 Tools 
Hopefully this will help someone else out with the same issue.


  1. Thanks for this post - saved me a good bit of time figuring out why my project wouldn't build in Team City. Cheers, Karl

    1. Glad it helped. Infrastructure problems are so frustrating when you just want to get on and code.

  2. this helped me too - thanks for taking the time to post it.

  3. Thank you very much! Very helpful.