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
    http://www.microsoft.com/downloads/en/confirmation.aspx?familyId=e6e1c3df-a74f-4207-8586-711ebe331cdc&displayLang=en
    or 7.1/3.5 at
    http://www.microsoft.com/downloads/en/confirmation.aspx?familyId=c17ba869-9671-4330-a63e-1fd44e0e2505&displayLang=en
    or 7.1/4.0
    http://www.microsoft.com/downloads/en/details.aspx?FamilyID=6b6c21d2-2006-4afa-9702-529fa782d63b&displaylang=en#SystemRequirements.
  2. Copy the files from your dev box:
    C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web
    and
    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
    Alter:
    <AspNetMerge
         ExePath="$(AspnetMergePath)"
    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.

4 comments:

  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

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

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

    ReplyDelete
  3. Thank you very much! Very helpful.

    ReplyDelete