我该如何更改Team Foundation Build下MSBuild使用的构建目录?

8
当我尝试使用Team Foundation Build构建我的应用程序时,出现以下错误: C:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(1682,9): error MSB3554: 无法写入输出文件“obj\Release\Company.Redacted.BlahBlah.Localization.Subsystems.Startup_Shutdown_Processing.StartupShutdownProcessingMessages.de.resources”。指定的路径、文件名或两者都太长了。完全限定文件名必须小于260个字符,目录名必须小于248个字符。 我的项目在开发机上构建良好,因为源代码只有两个文件夹深度,但是TF Build似乎使用一个非常深的目录,导致它无法正常工作。我该如何更改所使用的文件夹? 编辑:我检查了存储在源代码控制中的我的构建.proj文件,并找到了以下内容:
<!--  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>

如果这个被存储在数据库里,我该如何更改它?
编辑:找到了以下博客文章,这可能会指引我找到解决方案。现在我只需要弄清楚如何在构建代理中更改设置。http://blogs.msdn.com/jpricket/archive/2007/04/30/build-type-builddirectorypath-build-agent-working-directory.aspx 目前我的工作目录是“$(Temp)\$(BuildDefinitionPath)”,但现在我不知道有哪些通配符可用于指定不同的文件夹。
2个回答

16
您需要编辑构建代理的工作目录,以便缩小起始路径。要编辑构建代理,请右键单击“Builds”节点,然后选择“Manage Build Agents...”。
个人建议使用类似c:\bw\$(BuildDefinitionId)的路径。$(BuildDefinitionId)会被翻译成构建定义的ID(因此得名 :-)),这意味着您将获得一个以c:\bw\36为开头而不是c:\Documents and Settings\tfsbuild\Local Settings\Temp\BuildDefinitionName的构建路径。
祝好运,
马丁。

为了将来的参考,原始值是 $(SystemDrive)\Builds$(BuildAgentId)$(BuildDefinitionPath)。 - Simon
另一个好的资源是http://blogs.msdn.com/b/aaronhallberg/archive/2007/06/20/team-build-and-260-character-paths.aspx。 - Simon

0

你需要从源代码控制资源管理器中检出构建脚本文件,并动手替换路径。


请参见问题澄清。 - Luke
1
提问者似乎在使用TFS 2008。这个建议适用于TFS 2005。 - Martin Woodward

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接