2011-04-12 2 views
0

저는 msbuild를 처음 사용했지만 Google에서도 MSBuild (아래 참조)의 CallTarget에서 속성을 반환하는 방법을 알지 못합니다. 이에MSBuild에서 CallTarget이 호출 한 대상의 속성을 반환합니다.

<Target Name="CheckDbStgExists" 
    DependsOnTargets="CreateDbStgExistsProp"> 
    <CallTarget Targets="DBExists" /> 

: 대상이 CallTarget으로 실행되면

<Target Name="CheckDbStgExists" 
    DependsOnTargets="CreateDbStgExistsProp;DBExists"> 

하면, 생성 된 동적 속성이있는 "게시"하는 것을 불가능 또는

<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> 

답변

0

변경이인가 DependsOnTargets 때문에 실행되는 것과는 다른 방식으로 실행됩니다.

+0

완벽하고 정확하게 필요한 것. – dim

관련 문제