title: Zip all folders in MSBuild
body: <p>I can zip an explicit list of folders like this:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;ItemGroup&gt;
    &lt;Folder Include="Foo\**\*.*"&gt;&lt;Name&gt;Foo&lt;/Name&gt;&lt;/Folder&gt;
    &lt;Folder Include="Bar\**\*.*"&gt;&lt;Name&gt;Bar&lt;/Name&gt;&lt;/Folder&gt;
  &lt;/ItemGroup&gt;
  &lt;Zip
    ZipFileName="%(Folder.Name).zip"
    WorkingDirectory="%(Folder.Name)\"
    Files="@(Folder)" /&gt;
  </code></pre>
  
  <p>This creates two zip files <code>Foo.zip</code> and <code>Bar.zip</code>, one for each folder <code>Foo\</code> and <code>Bar\</code>.</p>
  
  <p>How can I do this for <strong>all</strong> existing folders? (Without listing each folder explicitly. When a new folder <code>New\</code> is created, a zip file <code>New.zip</code> should be created automatically without changing the MSBuild file.)</p>
  
  <p>(I'm using the Zip task from the MSBuild.Community.Tasks)</p>