A pedant that hangs out in the dark corner-cases of the web.

Thursday, May 17, 2007

Here's how to Team Build a Web Application Project

Update: Aaron Hallberg : Team Build and Web Deployment Projects

  1. First, create a Web Deployment Project for your Web Application Project. (If you have a Web Site Project, you will need to convert the Web Site Project to a Web Application Project before continuing.)
  2. Set the Output Folder to the destination UNC for the Debug and Release build types.
  3. Set any other WDP properties appropriate to your environment, such as Web.config file section replacement.
  4. Make sure your build server has VisualStudio and VS SP1 installed. If the server does not have the C:\Program Files\MSBuild\Microsoft\WebDeployment\ folder, you may need to install Web Deployment Projects as well.
  5. Create fixup.TeamWebDeployment.targets (see below) in C:\Program Files\MSBuild\. Normally, the Team Build drop location overrides the Output Folder, so this file adds a second compile task to put the web app where you wanted it to go in the first place.
  6. Add an import directive for $(MSBuildExtensionsPath)\fixup.TeamWebDeployment.targets.
  7. Create the team build, choosing your solution and build type, but you MUST choose Mixed Platforms as the Platform, or things will go very badly for you.
  8. Cross your fingers and run the build.
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="AfterBuild" Condition="$(OutputPath) != $(WDTargetDir)">
<RemoveDir Condition="'$(DeleteAppDataFolder)' == 'true'" Directories="$(OutputPath)\App_Data"/>

Also, I have to ask any MS folks out there: Why C:\Program Files\MSBuild\ ? Why not C:\Program Files\Common Files\MSBuild\ or C:\Documents and Settings\<current/all user(s)>\Application Settings\Microsoft\MSBuild\ ? This adds yet another customizable location that needs to be backed up.


Amaris said...

Great work.

Selkie said...

here is an example of a post that requires screenshots.

Not sure what you mean by number 2.

Brian said...

This post is pretty old, so the info is stale.

I've since given up on a pure MSBuild/TFSBuild solution in favor of FinalBuilder. I'd like to spend some time learning more about the new Web Deployment stuff, though, too.