覆盖MSBuild在TFS 2008/2010中创建标签的位置 [英] Override where a label is created by MSBuild in TFS 2008/2010

查看:90
本文介绍了覆盖MSBuild在TFS 2008/2010中创建标签的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

默认情况下,当运行排队的内部版本时,MSBuild会调用CoreLabel任务来标记内部版本中包含的源文件-如何控制该标签的创建位置?

By default, when a queued build is running, MSBuild calls the CoreLabel task to label the source files that were included in the build - how do I control where this label is created?

基本上,我希望在 Team Project 的根目录下创建标签(即下面的文件夹"Client"),但是标签似乎是在用于工作区的工作文件夹(即Project 1 \ Development \ Sources):

Basically, I would like the label to be created at the root of the Team Project (i.e. folder "Client" below), however it appears that the label is created at the root of the working folder for the workspaces (i.e. Project 1\Development\Sources):

$                     <-- Project Collection
+- Client             <-- Team Project
  +- Project 1        <-- Project
    +- Deployments    <-- Assets for a deployment
      +- 1.0.0.0
      +- 1.1.0.0
    +- Development    <-- Development Branch
      +- Source       <-- Dev Build Definition working folder mapped here.
    +- Environment    <-- Scripts, etc. for deployments.
    +- Main           <-- Main Branch
      +- Source       <-- Release Build Definition working folder mapped here.

在构建定义中,我们根据构建类型在源"文件夹级别为开发"或主要"文件夹中的工作区中指定了工作文件夹".

Within the build definitions, we have specified a "Working folder" in the workspace at the "Source" folder level for either Development or Main depending on the build type.

查看构建日志,看起来应该在客户端级别创建标签:

Looking at the build logs, it looks like the label should be created at the Client level:

Task "Label" (TaskId:42)
  Label TeamFoundationServerUrl="http://TFSServer:8080/tfs/DefaultCollection"
        BuildUri="vstfs:///Build/Build/4538" 
        Name="Nightly_20110303.5" 
        Scope="$/Client" 
        Recursive=True 
        Comments="Version-1.0.0.0 Requested-xxx Get-T Branch-Development"
        Version="WCATQCDEV-BLD_35_8"
        Child="Replace"
        Files="$/" (TaskId:42)
  Label Nightly_20110303.5@$/Client (version WCATQCDEV-BLD_35_8) was successfully created. (TaskId:42)

但是,即使将Files设置为$/,仍会在工作文件夹级别创建标签.根据文档,应该使用Files参数指定标签中包含哪些文件,但是显然,它不能按我们希望的那样工作.

However, even though Files is set to $/ the label is still created at the working folder level. According to the documentation, the Files parameter is supposed to specify which files are included in the label, but clearly it's not working quite as we'd like.

我已经成功修改了使用BeforeLabel任务设置的LabelComment属性创建的注释,但是,尝试将同一任务中的LabelFiles属性设置为类似$/Client的内容会影响创建标签的位置,并且在调用Label方法时,它似乎最终会在日志中损坏为%26/Client.

I've successfully modified the comment that is created using the BeforeLabel task setting the LabelComment property, however, trying to set the LabelFiles property in the same task to something like $/Client doesn't seem to affect the location the Label is created at, and also seems to end up mangled to %26/Client in the log when it calls the Label method.

推荐答案

将为该特定构建类型的工作区选项卡中指定的源代码管理文件夹创建标签.

Label will be created for the Source Control Folder specified in workspace tab of that particular build type.

如果在构建类型"中将开发"指定为源代码管理文件夹,则将仅为开发"文件夹下的文件创建标签.

If you are specifying "Development" as the Source Control Folder in Build Type, then Label will be created only for the files under "Development" folder.

标签不仅通过名称进行标识,而且通过所谓的作用域"进行标识,其中范围是标签名称唯一的实际路径.

The label is identified not only by name, but also by so-called "scope", where scope is the actual path within which the label name is unique.

如果标签范围是"$/project",则标签名称在Project中是唯一的;并且当范围为"$/Project/Development"时,标签名称在开发"中是唯一的.

If your label scope is "$/project", that the label name is unique within Project; and when scope is "$/Project/Development", the label name is unique within Development.

范围="$/客户"

在日志文件中的上方输入并不意味着它正在为$/Client下的文件创建标签,而是实际上意味着所创建的标签在$/Client中是唯一的.

Above entry in your log file doesn't mean that it's creating label for files under $/Client, but it actually means that the label created is unique in $/Client.

该范围还允许用户在同一项目中创建多个具有相同名称的标签.例如:可以为同一项目中的不同范围创建两个名称相同的标签,称为"Test"("$/project"和"$/Project/Development").

The scope also allows users to create multiple labels with same name within the same project. For ex: Two labels with same name called "Test" can be created for different scopes in same project("$/project" and "$/Project/Development").

这篇关于覆盖MSBuild在TFS 2008/2010中创建标签的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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