从MSBuild中CallTarget调用的目标返回属性
我不熟悉msbuild,但即使使用google,我也不知道如何从msbuild中的CallTarget返回属性(见下文)。这是不可能的还是不可能的从MSBuild中CallTarget调用的目标返回属性,msbuild,msbuild-propertygroup,Msbuild,Msbuild Propertygroup,我不熟悉msbuild,但即使使用google,我也不知道如何从msbuild中的CallTarget返回属性(见下文)。这是不可能的还是不可能的 <Target Name="CreateDbStgExistsProp"> <!-- See http://stackoverflow.com/questions/1373162/passing-property-group-value-from-one-msbuild-task-to-another why this
<Target Name="CreateDbStgExistsProp">
<!-- See http://stackoverflow.com/questions/1373162/passing-property-group-value-from-one-msbuild-task-to-another why this workaround is needed -->
<PropertyGroup>
<db>$(dbStg)</db>
<machine>$(dwhdbStgmachine)</machine>
</PropertyGroup>
</Target>
<Target Name="CheckDbStgExists" DependsOnTargets="CreateDbStgExistsProp">
<CallTarget Targets="DBExists"/>
<!-- this should pass the Property DoesDbExist for further reference created in Target DBExists, but it does not seem to work -->
<Message Text="Test: $(DoesDbExist)"/>
</Target>
<Target Name="DBExists" >
<MSBuild.ExtensionPack.Sql2008.Database TaskAction="CheckExists" MachineName="$(machine)" DatabaseItem="$(db)" LogExceptionStack="true">
<Output TaskParameter="Exists" PropertyName="DoesExist"/>
</MSBuild.ExtensionPack.Sql2008.Database>
<Message Text="Database $(db) does NOT exists" Condition="!$(DoesExist)"/>
<Message Text="Database $(db) does exist" Condition="$(DoesExist)"/>
<PropertyGroup>
<DoesDbExist>$(DoesExist)</DoesDbExist>
</PropertyGroup>
</Target>
美元(dbStg)
$(dwhdbStgmachine)
$(性别歧视者)
更改此选项:
<Target Name="CheckDbStgExists"
DependsOnTargets="CreateDbStgExistsProp">
<CallTarget Targets="DBExists" />
为此:
<Target Name="CheckDbStgExists"
DependsOnTargets="CreateDbStgExistsProp;DBExists">
当使用CallTarget执行目标时,创建的任何动态属性都会以不同的方式“发布”,而不是因为依赖目标而运行它。Perfect,这正是我所需要的。