Adam Stiskala
Adam Stiskala

Reputation: 467

Populating a VSO Build vNext build variable from MSBuild

I have an MSBuild task that populates a variable that I would like to use later in the build process (specifically as an argument in a command line build step).

Is there any way to access an MSBuild variable in subsequent build step?

Upvotes: 1

Views: 866

Answers (1)

Pascal Berger
Pascal Berger

Reputation: 4342

You can use the ##vso[task.setvariable]value logging command from your MSBuild task to pass the variable to VSO like this:

<Message Text="##vso[task.setvariable variable=myvariable;]$(MyMSBuildProperty)" />

You can use the variable in a subsequent build step by using $(myvariable) in the input fields of the command line build task.

Upvotes: 3

Related Questions