Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pass property value from TFS Build Definition to proj file

I have a build definition set up in my TFS 2012 instance. In this Build Definition I want to pass in a custom argument and access said argument in my .csproj file. For example:

MSBuild Arguments: /p:MyFoo=1

In my .csproj file I want to do this:

<ItemGroup Condition=" '$(MyFoo)' == '1' ">

Is this possible, or am I going about this incorrectly?

like image 856
Matt Avatar asked Feb 26 '13 15:02

Matt


1 Answers

This is more than possible, it's very easy to do. Edit your build definition, under the process tab expand the "advanced" section and you will see a property called "MSbuild Arguments" add the argument in the format in the question. e.g. /p:MyFoo=1

e.g.

adding msbuild arguments to TFS build definition

You can also enter the arguments when you queue a build

enter image description here

like image 188
James Reed Avatar answered Nov 13 '22 06:11

James Reed