对于 TFS 2008 Team Build,如何更改 $Temp 指向的位置?
我们最近构建了一个新的 TFS 2008 Team Build 服务器。 我不希望用户将其构建放在构建代理的 $Temp 指向的默认临时目录中,但我也不想强迫开发人员将路径更改到其他位置 - 这会给开发人员带来风险要么(a)不打扰,要么(b)制定与其他团队不一致的路径。
因此,我想将 $Temp 保留在那里(这是创建构建代理时的默认值),但更改它指向的位置。 我怎么做?
We have recently built a new TFS 2008 Team Build server. I don't want users putting their builds in the default temp directory that is pointed to by $Temp for the Build Agent, but I also don't want to force developers to change the path to somewhere else - this runs the risk of developers either (a) not bothering, or (b) making paths that are not consistent with other teams.
So I would like to keep the $Temp there (which is the default for when creating a Build Agent), but change the location where that points to. How do I do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
$Temp 值是运行构建代理进程的用户的 Temp 环境变量的值。 您可以更改构建用户的临时位置 - 但这可能不是您想要的,因为这是您必须对构建用户环境执行的设置,而不仅仅是本地化到构建代理进程。
就个人而言,我将构建代理工作目录设置为 d:\bw\$(BuildDefinitionId) 之类的目录,其中 d 是相当快的辅助驱动器 - 但 c:\bw 也可以。 这意味着构建是在路径较短的地方进行的,因此您不太可能遇到 .NET IO 类强加的烦人的 260 个字符路径限制。
据推测,创建构建代理不是您的开发人员正在做的事情,而是更多的管理任务 - 但是,如果您确实想确保它按照您想要的方式完成,您可以使用 TFS Build API 来自内部 ASP.NET 页面或小型应用程序。 这将为您提供限制构建工作目录设置位置所需的控制权。
如果您需要用于创建构建代理的 API 代码,请在评论中告诉我,我将编辑我的答案。
The $Temp value is the value of the Temp environment variable for the user that the build agent process is running as. You could change the temp location for the build user - however that might not be what you want as that is a setting you will have to do to the build users environment, not just localized to the build agent process.
Personally, I set my build agent working directories to something like d:\bw\$(BuildDefinitionId) where d is a fairly fast secondary drive - however c:\bw would do just as well. This means that the builds are conducted in a place with a short path so you are less likely to run into the annoying 260 character path limit imposed by .NET's IO classes.
Presumeably, creating build agent's isn't something that your developers are doing but more of an administrative task - however if you really wanted to make sure it was done how you wanted you could provision the build agent using the TFS Build API from an internal ASP.NET page or a little application. That would give you the control you need to limit where the build working directory is set.
If you want API code for creating a build agent then let me know in the comments and I will edit my answer.