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>
精彩评论