For TFS 2008 Team Build, how do I change where $Temp points to?

For TFS 2008 Team Build, how do I change where $Temp points to?

裸钻 发布于 2021-12-01 字数 552 浏览 781 回复 1 原文

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?

如果你对这篇文章有疑问,欢迎到本站 社区 发帖提问或使用手Q扫描下方二维码加群参与讨论,获取更多帮助。



需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。


愁杀 2022-06-07 1 楼

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.