我正在尝试根据另一个PropertyGroup的值来设置PropertyGroup:
<PropertyGroup Condition="'$(BuildDefinitionName)'=='Dev1'">
<DeploymentServer>DEVSERVER</DeploymentServer>
</PropertyGroup>
<PropertyGroup Condition="'$(BuildDefinitionName)'=='Main'">
<DeploymentServer>MAINSERVER</DeploymentServer>
</PropertyGroup>
<PropertyGroup Condition="'$(BuildDefinitionName)'=='Release'">
<DeploymentServer>RELEASESERVER</DeploymentServer>
</PropertyGroup>后来我有了这个目标
<Target Name="AfterEndToEndIteration" Condition="'$(DeploymentServer)'!=''">
</Target>未执行此目标,因为$(DeploymentServer的计算结果为'‘。但是,如果我无条件地设置该属性:
<PropertyGroup>
<DeploymentServer>SCHVMOMNET3</DeploymentServer>
</PropertyGroup>它起作用了--目标被执行了。
$(BuildDefinitionName)属性是可以的,因为我在其他地方将它用作.testconfig文件的名称。
如何让我的目标基于有条件定义的属性执行?
发布于 2010-06-16 22:01:57
我通过将PropertyGroup放入我的目标中实现了这一点:
<Target Name="AfterEndToEndIteration">
<PropertyGroup>
<DeploymentServer Condition="'$(BuildDefinitionName)'=='Dev'">DEVSERVER</DeploymentServer>
<DeploymentServer Condition="'$(BuildDefinitionName)'=='Main'">MAINSERVER</DeploymentServer>
<DeploymentServer Condition="'$(BuildDefinitionName)'=='Release'">RELEASESERVER</DeploymentServer>
</PropertyGroup>
</Target> https://stackoverflow.com/questions/3052557
复制相似问题