检索解决方案的路径? [英] Retrieving path to solution(s)?

查看:22
本文介绍了检索解决方案的路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们目前正在为我们的公司设置 Team Build 2010,我正在尝试使用工作流活动来检索当前正在构建的解决方案的确切本地路径.我还没有找到获取此值的方法,有没有人知道如何(无需编写自定义活动)?

We are currently setting up Team Build 2010 for our company, and I am trying to use workflow activities to retrieve the exact local path to the current solution being built. I haven't found a way to get this value, does anybody know how (without writing a custom activity)?

服务器或本地路径之一就足够了(即 $/TeamProject/Branch/OurProjectC:\TeamBuild\src\path\to\branch\OurProject) 因为我们可以在服务器项目上使用转换活动.

Either one of server or local path would suffice (i.e $/TeamProject/Branch/OurProject or C:\TeamBuild\src\path\to\branch\OurProject) since we can use the conversion activities on the server item.

我们需要此路径的原因是为了更新版本信息文件,并且只需要为正在构建的当前解决方案完成,并且文件具有相同的名称(例如 AssemblyInfo.cs).

The reason we need this path is for updating version info files, and that needs to be done for only the current solution being built, and the files have the same names (AssemblyInfo.cs, for example).

在这个类似问题,解决方案是定义一个参数,但由于此信息特定于正在构建的解决方案而不是某些外部路径,因此我们希望可以检索此信息.

In this similar question, the solution is to define a parameter, but since this information is particular to the solution being built and not some external path, we were hoping that this info would retrievable.

推荐答案

您无需添加任何内容即可检索此特定信息.如果您在构建过程模板中导航到 MSBuild 爆发的位置,您将看到应构建的解决方案设置为名为 localProject 的字符串.
这将包含 TFS 下载您的 SLN 的本地路径,例如 C:\TeamBuild\src\path\to\branch\OurProject\OurProject.sln.

打开 XAML 并导航到:

You can retrieve this particular info without adding anything. If you navigate within your Build Process Template to the position where MSBuild breaks out, you will see that the solution that shall be build is set as a string named localProject.
This will contain the local path where TFS has downloaded your SLN, something like C:\TeamBuild\src\path\to\branch\OurProject\OurProject.sln.

Open the XAML and navigate to:

Run On Agent
  Try Compile, Test, and Associate Changesets and Work Items
    Compile, Test, and Associate Changesets and Work Items
      Try Compile and Test
        Compile and Test
          For Each Configuration in BuildSettings.PlatformConfigurations
            Compile and Test for Configuration
              If BuildSettings.HasProjectsToBuild
                For Each Project in BuildSettings.ProjectsToBuild
                  Try to Compile the Project
                    Compile the Project
                      Run MSBuild for Project

如果您选择 Run MSBuild for Project &按 F4 即可.

if you select Run MSBuild for Project & hit F4 you see it.

为了在您可以在构建过程模板中定义另一个字符串变量 solutionPath 之后检索您的内容 &在 Run MSBuild for Project 下插入一个新的 Assign 活动,其中

To : solutionPath
Value: Path.GetDirectoryName(localProject)

In order to retrieve what you are after you can define another string-variable solutionPath in your Build Process Template & insert under the Run MSBuild for Project a new Assign activity with

To : solutionPath and
Value : Path.GetDirectoryName(localProject)

这篇关于检索解决方案的路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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