在TFS描述字段中嵌入文本(Embedding Text in TFS Description Fi

2019-09-17 12:17发布

我有一个关于描述字段中TFS问题。 目前TFS描述字段为空字段用户在其中添加任何信息。 是否有可能嵌入一些类型的文本?

例如:当创建一个新的bug,TFS描述字段为空。 相反,我希望能有说明字段中填入以下。

  1. 配置和日志
  2. 版本和环境
  3. 再现步骤
  4. 设备/环境
  5. 截图或相关文件(证书等)连接

我认为这将是类似于使用默认值标签只是创建的错误时,它会做。

谢谢

Answer 1:

我想出了解决方案。

我现在的描述字段是纯文本字段,所以我设置的场X.我在最初的过渡这样做的创建的Bug工作项目时的默认值。

然后,我导出的工作项XML和搜索:

<FIELD refname="System.Description">

右下它,我发现默认值的标签,它是这样的:

<DEFAULT from="value" value="1. Configuration and Logs 2. Version and Environment" />

我继续添加XML标记特征线&#xD; 到线分开。 新的默认应该是这样的

<DEFAULT from="value" value="1. Configuration and Logs &#xD; 2. AW Version and Environment" />

最后,我导入修改Bug.xml和测试它。 现在,每当我打开一个新的bug,这些线路将在描述字段可见



Answer 2:

I have not been able to find any support for this on current releases of TFS (e.g. 2015), so I went ahead figured this out myself.

This information was tested and working on TFS 2015, I assume it should on 2013 as well, I just cannot test that.

To start and understand I'll clear couple things up.

  • The bug WIT steps to reproduce field is a html field.

  • XML forms have special markup for certain characters, that are in a string for example.

    & = &amp;
    < = &lt;
    > = &gt;
    " = &quot;
    ' = &apos;
    
  • Example for this would be to add string value of the word "Reproduction Steps" in bold. The bug WIT steps to reproduce field is HTML, so we'll add HTML markup using the special XML markup.

    <b>Reproduction Steps</b>
    

    Would look like this inside the bug.xml:

    &lt;b&gt; Reproduction Steps &lt;/b&gt;
    

Now putting this all together, you'll want to export the bug WIT so you can edit the bug.xml and import back to project when done.

Tools > Process Editor > Work Item Types > Export WIT

Then you'll find this line in the bug.xml

<FIELD name="Repro Steps" refname="Microsoft.VSTS.TCM.ReproSteps" type="HTML"/>

You'll edit this to make it look like what is below, to embed the text inside the steps to reproduce bug field.

      <FIELD name="Repro Steps" refname="Microsoft.VSTS.TCM.ReproSteps" type="HTML">
    <DEFAULT from="value" value="All the embedded html/xml text will go here" />
  </FIELD>

Final product with requested text from OP will look like this.

<FIELD name="Repro Steps" refname="Microsoft.VSTS.TCM.ReproSteps" type="HTML">
<DEFAULT from="value" value="&lt;b&gt; Configuration and Logs &lt;/b&gt; &lt;br/&gt;
        &lt;b&gt; Reproduction Steps&lt;/b&gt; &lt;br/&gt;
        &lt;b&gt; Device/Environment&lt;/b&gt; &lt;br/&gt;          
        &lt;b&gt; Screenshots or related files (certificates, etc.) are attached&lt;/b&gt; &lt;br/&gt;" />
 </FIELD>

Once you save that bug.xml, you'll want to go back into visual studio and import it.

Tools > Process Editor > Work Item Types > Import WIT



文章来源: Embedding Text in TFS Description Field