将属性值从TFS Build Definition传递到proj文件

时间:2013-02-26 15:28:28

标签: msbuild tfsbuild tfs2012

我在TFS 2012实例中设置了构建定义。在这个构建定义中,我想传入一个自定义参数并在我的.csproj文件中访问所述参数。例如:

MSBuild Arguments: /p:MyFoo=1

在我的.csproj文件中,我想这样做:

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

这是可能的,还是我错了?

1 个答案:

答案 0 :(得分:11)

这是可能的,这很容易做到。编辑您的构建定义,在进程选项卡下展开“高级”部分,您将看到一个名为“MSbuild Arguments”的属性,以问题的格式添加参数。例如/p:MyFoo=1

e.g。

adding msbuild arguments to TFS build definition

您还可以在对构建进行排队时输入参数

enter image description here

相关问题