开发者

How can I branch based on user input in MSBuild?

How can I stop or continue a build, based on user input, using MSBuild?

I currently have this in my project file:

<Target Name="Afterbuild">
    <MSBuild.ExtensionPack.UI.Dialog TaskAction="Confirm" Title="Production Deployment" Button1Text="Continue" Button2Text="Cancel" Text="WARNING !!! You are about to overwrite code on the prodution server. Please confirm!">
        <Output TaskParameter="ButtonClickedText" PropertyName="Clicked"/>            
    </MSBuild.ExtensionPack.UI.Dialog>

    <Message Text="User Clicked: $(Clicked)"/>
    <Message Text="User Typed: $(Typed)"/>
</Target>

I am unsure of开发者_运维百科 how to proceed.


You could use the error task with a condition :

<Target Name="Afterbuild">
  <MSBuild.ExtensionPack.UI.Dialog TaskAction="Confirm" Title="Production Deployment" Button1Text="Continue" Button2Text="Cancel" Text="WARNING !!! You are about to overwrite code on the prodution server. Please confirm!">
    <Output TaskParameter="ButtonClickedText" PropertyName="Clicked"/>            
  </MSBuild.ExtensionPack.UI.Dialog>

  <Error Condition="'$(Clicked)' == 'Cancel'"
         Text="Build have been canceled by user"/>

  <CallTarget Condition="'$(Clicked)' == 'Continue'"
              Targets="ContinueBuild"
              Text="Proceed with build"/>
</Target>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜