如何从 msbuild 命令分配值 teamcity 变量

How to assign a value teamcity variable from msbuild command

我有一个 msbuild 步骤,我将在其中解析 xml 文件并获取一些过滤数据。我需要将过滤后的数据传递给 Teamcity。这可以通过 teamcity 变量或任何其他方式完成吗?

<Target Name="ParseXmlAndReturn" >
<XmlPeek XmlInputPath ="$(ResultDir)\xmlfile.xml"
         Query="<filter to get specific data from xml>">
  <Output TaskParameter="Result" PropertyName="parsedxml"/>
</XmlPeek>
<Message Text="parsed xml is $(parsedxml)"/>

从 msbuild 的上述任务中,我需要将解析的xml值传递给 teamcity 或将系统变量分配给 teamcity 到解析值。

来自 Teamcity“Build Script Interaction”文档:

By using a dedicated service message in your build script, you can dynamically update some build parameters right from a build step, so that the following build steps will run with a modified set of build parameters. ##teamcity[setParameter name='ddd' value='fff']

所以将消息的标题改为

<Message Text="##teamcity[setParameter name='ParsedXML' value='$(parsedxml)']"/>