1

我有一个目标作为我的构建的一部分,我希望在评估一些命令行检查时跳过它:

<Target Name="RunSomeDependencyVerification" Condition="!Exists('$(SkipVerification)')">
....

我想从控制台传递跳过验证,这样:

msbuild mybuild.dev.proj /p:SkipVerification

我的构建脚本抱怨未定义“SkipVerification”属性。我找到了文档,<PropertyGroup />但似乎不仅定义了属性,还设置了值,这不是我想要的。

我错过了什么?

4

2 回答 2

1

Define your property with a default value in your original msbuild file.

<PropertyGroup>
    <SkipVerification Condition="'$(SkipVerification)'==''">False</SkipVerification>
</PropertyGroup>

The "Exists" checks is not for "propertyname", whether you specified it or not. Check the VALUE of your property.

<Target Name="RunSomeDependencyVerification" Condition="'$(SkipVerification)'=='True'">

Then this.

/p:Configuration=Debug;SkipVerification=True
于 2013-07-22T17:44:54.427 回答
0

Msbuild says SkipVerification is not defined because it isn't: Exists is for files or directories, not for properties. Try this instead:

msbuild mybuild.dev.proj /p:SkipVerification=true

And then check on the value:

<Target Name="RunSomeDependencyVerification"
        Condition="'$(SkipVerification)'!='true')">
于 2013-07-22T17:44:23.140 回答