Variable of Solution Directory (or something close) in TFS 2010 Build

不打扰是莪最后的温柔 提交于 2019-12-11 05:31:37

问题


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).

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.


回答1:


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.

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

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.



来源:https://stackoverflow.com/questions/7179564/variable-of-solution-directory-or-something-close-in-tfs-2010-build

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!