I have a custom pubxml file which contains a Target that executes a powershell script. This powershell command successfully runs before my site is deployed.
If an error occurs in the powershell script, the output is put in the Output window, but the build continues and the final message will be Publish: 1 succeeded. How can I stop the publish if my powershell script errors?
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PipelineDependsOn>
CopyConfigFiles;
$(PipelineDependsOn);
</PipelineDependsOn>
<WebPublishMethod>FileSystem</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<publishUrl></publishUrl>
<DeleteExistingFiles>False</DeleteExistingFiles>
</PropertyGroup>
<Target Name="CopyConfigFiles">
<Message Text="********************************** Deploying Config Files ***********************************" Importance="high"/>
<Exec Command="powershell.exe -ExecutionPolicy ByPass -File "$(SolutionDir)/Config/CopyConfigFiles.ps1" -ConfigSource "$(SolutionDir)/Config/""/>
</Target>