Raghavendra Bankapur
Raghavendra Bankapur

Reputation: 903

How to assign a value teamcity variable from msbuild command

I have a msbuild step where I will parse the xml file and get some filtered data. I need to pass the filtered data to Teamcity. Could this be done by teamcity variable or any other way?

<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)"/>

From the above task of msbuild, I need to pass parsedxml value to teamcity or assign a systemvariable to teamcity to the parsedvalue.

Upvotes: 1

Views: 383

Answers (1)

stijn
stijn

Reputation: 35901

From the Teamcity 'Build Script Interaction' documentation:

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']

So change the message tack to something like

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

Upvotes: 1

Related Questions