TFS 2010 Build 中解决方案目录(或接近的东西)的变量 [英] Variable of Solution Directory (or something close) in TFS 2010 Build

查看:27
本文介绍了TFS 2010 Build 中解决方案目录(或接近的东西)的变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在构建结束时运行调用命令.我试图让它运行一个批处理文件.

I am running a Invoke Command at the end of my build. I am trying to get it to run a batch file.

但我不想硬编码批处理文件的路径(以防我将构建移动到不同的构建服务器).

But I don't want to hard code the path to the batch file (in case I move my build to a different build server).

我需要一个变量来放入 IvokeProcess 的 WorkingDirectory.在 TFS 2008 Build 中,我会使用 $(SolutionDir).但是我在 TFS 2010 Build 中找不到类似的东西.(我尝试了 Environment.CurrentDirectory 并且得到了 C:\Windows\System32

I need a variable to put in for the WorkingDirectory of IvokeProcess. In TFS 2008 Build I would have used $(SolutionDir). But I can't find anything like that in TFS 2010 Build. (I tried Environment.CurrentDirectory and I got C:\Windows\System32

我该怎么做才能获得对我的解决方案(或项目)所在路径的引用.

What can I do to get a reference to the path that my solution (or project) is in.

推荐答案

对于您要完成的任务类型,我建议不要关注工作目录".

I would advise against focusing on the 'Working Directory' for the type of task you 're trying to accomplish.

您可以打开构建过程模板 &添加一个新参数(类型 = 字符串,方向 = 输入),默认值等于批处理文件的当前完整路径.

You can open your build process template & add a new Argument (type = string, Direction = In), with default value equaling the current full path to your batch file.

然后在您的 InvokeProcess 活动的参数中设置它.这是我调用 NCover 的方法:

Then set this in argument in your InvokeProcess activity. Here is how I invoke NCover:

在默认值中,我只是简单地设置了C:\Program Files\NCover\NCover.Console.exe"

In the default value I have simply set "C:\Program Files\NCover\NCover.Console.exe"

现在每个构建定义都有一个附加参数(在进程"下),默认值是当前有意义的值.

Now each build definition has an additional parameter (under 'Process'), with default value the one that currently makes sense.

如果我们转移到另一个构建服务器,我将不得不简单地更新构建定义.

Should we move to another build server, I would have to simply update the build definitions.

这篇关于TFS 2010 Build 中解决方案目录(或接近的东西)的变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆