How do I change the build directory that MSBuild uses under Team Foundation Build?

15,115

You need to edit the build working directory of your Build Agent so that the begging path is a little smaller. To edit the build agent, right click on the "Builds" node and select "Manage Build Agents..."

I personally use something like c:\bw\$(BuildDefinitionId). $(BuildDefinitionId) translates into the id of the build definition (hence the name :-) ), which means you get a build path starting with something like c:\bw\36 rather than c:\Documents and Settings\tfsbuild\Local Settings\Temp\BuildDefinitionName

Good luck,

Martin.

Share:
15,115
Luke
Author by

Luke

I asked a lot of stupid questions and now I have a bunch of points!

Updated on June 20, 2022

Comments

  • Luke
    Luke almost 2 years

    I'm getting the following error when trying to build my app using Team Foundation Build:

    C:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(1682,9): error MSB3554: Cannot write to the output file "obj\Release\Company.Redacted.BlahBlah.Localization.Subsystems. Startup_Shutdown_Processing.StartupShutdownProcessingMessages.de.resources". The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.

    My project builds fine on my development machine as the source is only two folders deep, but TF Build seems to use a really deep directory that is causing it to break. How do I change the folders that are used?

    Edit: I checked the .proj file for my build that is stored in source control and found the following:

    <!--  BUILD DIRECTORY
     This property is included only for backwards compatibility. The build directory used for a build 
     definition is now stored in the database, as the BuildDirectory property of the definition's 
     DefaultBuildAgent. For compatibility with V1 clients, keep this property in sync with the value 
     in the database.
    -->
    <BuildDirectoryPath>UNKNOWN</BuildDirectoryPath>
    

    If this is stored in the database how do I change it?

    Edit: Found the following blog post which may be pointing me torward the solution. Now I just need to figure out how to change the setting in the Build Agent. http://blogs.msdn.com/jpricket/archive/2007/04/30/build-type-builddirectorypath-build-agent-working-directory.aspx

    Currently my working directory is "$(Temp)\$(BuildDefinitionPath)" but now I don't know what wildcards are available to specify a different folder.

  • Luke
    Luke over 15 years
    See clarification on question.
  • Martin Woodward
    Martin Woodward over 15 years
    The questioner sounds like he is using TFS 2008. This suggestion is the right answer for TFS 2005.
  • Simon
    Simon over 11 years
    for future reference the original value us $(SystemDrive)\Builds\$(BuildAgentId)\$(BuildDefinitionPath)
  • Simon
    Simon over 11 years