 <p>You can delete the files and/or directories prior to publishing like so:</p> <pre><code>&lt;RemoveDir Directories="$(MyDirectory)" Condition="Exists('$(TempDirectory)')" /&gt; &lt;Delete Files="$(MyFiles)" Condition="Exists('$(MyFiles)')" /&gt; </code></pre>