Troubleshooting Team Foundation Builds for Web Projects

The following section describes common troubleshooting scenarios you may experience when you build Web projects with Team Foundation Build.

Web Projects Are Not Being Built

The build configuration must be set to ".NET" for building Web projects only, and to "Mixed Platforms" for building a mix of Web projects and other managed projects in Visual Studio.

If you have specified an incorrect build configuration, this warning is recorded in the build log file:

Warning MSB4126: The specified solution configuration "Release|Any CPU" is invalid. Specify a valid solution configuration using the Configuration and Platform properties (e.g, MSBuild.exe Solution.sln /p:Configuration=Debug /p:Platform="Any CPU") or leave those properties blank to use the default solution configuration.

Solution

Change the configuration to "Mixed Platforms" or ".NET" by your build definition. Alternatively, when you create a new TFSBuld.proj file, select either ".NET" or "mixed Platforms" as the configuration on the Select configurations to build page of the MSBuild Project File Creation Wizard. For more information, see How to: Create a Build Definition.

Conflicting Directory Structures

By default, when you create a Web project in Visual Studio, the solution files and Web site files are stored in two different locations. For a Web project, "SampleWS," the solution files are saved in:

  • <root>:\Documents and Settings\user\My Documents\Visual Studio 2008\Projects\SampleWS

The Web site files are saved in:

  • <root>:\Documents and Settings\user\My Documents\Visual Studio 2008\Websites\SampleWS

A Web project solution file contains a PhysicalPath property that points to the Web site folder to locate it for compilation. However, when a Web project solution is checked in to source control, the solution file is stored in the root folder and the Web sites are stored in immediate sub folders. The result of this is broken PhysicalPath properties in the source-controlled solution file. During the build, Team Foundation Build synchronizes the Web project files by using the version control folder structure. Compilation errors result because the directory structure in version control differs from the solution folder structure.

If you have conflicting directory structures in the solution file and source control, this error is recorded in the build log file:

ASPNETCOMPILER(0,0): error 1003: The directory d:\<builddirectory>\MyTeamProject\SampleWS\WebSites\SampleWS\' doesn't exist.

Solution

  • Create a blank a solution in Visual Studio, and then create Web sites in the same location as the solution.

  • Modify the properties Debug.AspNetCompiler.PhysicalPath and Release.AspNetCompiler.PhysicalPath in the solution file to point to the source-controlled Web site folder.

Web Projects Using Multi-processor Team Build Fail

Team Foundation Build fails if you try to use multi-processor MSBuild with web projects or any other projects that invoke the ASP.NET compiler.

Solution

  1. For the build definition that is used by the builds that are failing, check out the TfsBuild.proj file for edit.

  2. Open TfsBuild.proj in Visual Studio, and set the BuildConfigurationsInParallel property to false in the first PropertyGroup element in TfsBuild.proj, as shown below:

    <PropertyGroup>
        <BuildConfigurationsInParallel>false</BuildConfigurationsInParallel>
    </PropertyGroup>

See Also

Other Resources

Administering Team Foundation Build

Troubleshooting Team Foundation Build

Managing Builds with Team Foundation Build