For the last couple of days I have been having trouble getting ASP.NET 2.0 sites building under the new Team Build feature of Team Foundation Server in VSTS. Basically I would create a team project, create a solution, add a web-site to the solution, then check it all into the TFS source code control.

From there I would define a build and kick it off. The build itself would complete successfully but upon inspecting the drop location, it would be completely empty. Even more mystifying is that if I added a class library, or indeed any other project type (other than ASP.NET or setup projects) it would work perfectly.

The problem has to do with the default build configurations that ASP.NET dumps into the solution file (remember, ASP.NET doesn’t have project files anymore). It says that it is a Debug (or Release) build for the .NET platform. The problem? Well, the big build file (TFSBuild.proj) contains this little gem:

  1 <ConfigurationToBuild Include="Release|Any CPU">
  2       <FlavorToBuild>Release</FlavorToBuild>
  3       <PlatformToBuild>Any CPU</PlatformToBuild>
  4 </ConfigurationToBuild>

In this instance the build file needs to be changed slightly to allow ASP.NET projects to build correctly:

  1 <ConfigurationToBuild Include="Release|.NET">
  2       <FlavorToBuild>Release</FlavorToBuild>
  3       <PlatformToBuild>.NET</PlatformToBuild>
  4 </ConfigurationToBuild>

I am posting this information up to my blog because I found very little information on the web about this exact problem. Personally I consider it a bug in the (seriously flawed) ASP.NET 2.0 project system, but I’ll save that discussion for another post (in the meantime go and read this post by Scott Guthrie to understand their reasons for the change).