I have a CopyDirectory step in my build template, and I was assuming that if it finds a directory that does not exist, it would throw errors. However, it is only throwing a warning, and the build itself is marked successful. 

I've tried to wrap it around a try/catch block, and manually did a 'throw' exception step, but still didn't work. I tried to set the buildStatus to failed, but that didn't work either. Any another way I can achieve this? I don't want the build to be successful if any of the copy directory fails.

**EDIT:** 

Here is the snippet where the copy directory is. I'm looping over a list of servers and copying a bunch of directories.

```
<ForEach x:TypeArguments="x:String" sap2010:WorkflowViewState.IdRef="ForEach`1_4" Values="[SCCDServers]">
                <ActivityAction x:TypeArguments="x:String">
                  <ActivityAction.Argument>
                    <DelegateInArgument x:TypeArguments="x:String" Name="server" />
                  </ActivityAction.Argument>
                  <Sequence sap2010:WorkflowViewState.IdRef="Sequence_37">
                    <mtbwa:CopyDirectory Destination="[server]" DisplayName="Copy Code Files" sap2010:WorkflowViewState.IdRef="CopyDirectory_14" Source="[BuildDetail.DropLocation &amp; &quot;\_PublishedWebsites\&quot; &amp; SCWebOutputFolder]" />
                    <mtbwa:WriteBuildMessage sap2010:WorkflowViewState.IdRef="WriteBuildMessage_16" Importance="[Microsoft.TeamFoundation.Build.Client.BuildMessageImportance.High]" Message="[&quot;Code Files copied to &quot; &amp; server]" mva:VisualBasic.Settings="Assembly references and imported namespaces serialized as XML namespaces" />
                    <mtbwa:CopyDirectory Destination="[server]" DisplayName="Copy Config Files" sap2010:WorkflowViewState.IdRef="CopyDirectory_15" Source="[BuildDetail.DropLocation &amp; &quot;\_PublishedWebsites\&quot; &amp; SCConfigSourceFolder &amp; &quot;\&quot; &amp; SCCDServerRole]" />
                    <mtbwa:WriteBuildMessage sap2010:WorkflowViewState.IdRef="WriteBuildMessage_17" Importance="[Microsoft.TeamFoundation.Build.Client.BuildMessageImportance.High]" Message="[&quot;Config Files copied to &quot; &amp; server &amp; Environment.NewLine &amp; &quot;Copied from: &quot; &amp; BuildDetail.DropLocation &amp; &quot;\_PublishedWebsites\&quot; &amp; SCConfigSourceFolder &amp; &quot;\&quot; &amp; SCCDServerRole]" mva:VisualBasic.Settings="Assembly references and imported namespaces serialized as XML namespaces" />
                    <mtbwa:CopyDirectory Destination="[server]" DisplayName="Copy Sitecore Files" sap2010:WorkflowViewState.IdRef="CopyDirectory_16" Source="[BuildDetail.DropLocation &amp; &quot;\_PublishedWebsites\&quot; &amp; SCSitecoreFilesSourceFolder]" />
                    <mtbwa:WriteBuildMessage sap2010:WorkflowViewState.IdRef="WriteBuildMessage_18" Importance="[Microsoft.TeamFoundation.Build.Client.BuildMessageImportance.High]" Message="[&quot;Sitecore Files copied to &quot; &amp; server &amp; Environment.NewLine &amp; &quot;Copied from: &quot; &amp; BuildDetail.DropLocation &amp; &quot;\_PublishedWebsites\&quot; &amp; SCSitecoreFilesSourceFolder]" mva:VisualBasic.Settings="Assembly references and imported namespaces serialized as XML namespaces" />
                  </Sequence>
                </ActivityAction>
              </ForEach>

```