如何根据用户输入使用MSBuild停止或继续构建?
我目前在我的项目文件中有这个:
<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>
我不确定如何继续。
答案 0 :(得分:4)
您可以将错误任务与条件
一起使用<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>