title: How to invoke the same msbuild target twice with different parameters from within msbuild project file itself
body: <p>I have the following piece of msbuild code:</p>
  
  <pre><code>  &lt;PropertyGroup&gt;
      &lt;DirA&gt;C:\DirA\&lt;/DirA&gt;
      &lt;DirB&gt;C:\DirB\&lt;/DirB&gt;
    &lt;/PropertyGroup&gt;
  
    &lt;Target Name="CopyToDirA"
            Condition="Exists('$(DirA)') AND '@(FilesToCopy)' != ''"
            Inputs="@(FilesToCopy)"
            Outputs="@(FilesToCopy -&gt; '$(DirA)%(Filename)%(Extension)')"&gt;
      &lt;Copy SourceFiles="@(FilesToCopy)" DestinationFolder="$(DirA)" /&gt;
    &lt;/Target&gt;
  
    &lt;Target Name="CopyToDirB"
            Condition="Exists('$(DirB)') AND '@(FilesToCopy)' != ''"
            Inputs="@(FilesToCopy)"
            Outputs="@(FilesToCopy -&gt; '$(DirB)%(Filename)%(Extension)')"&gt;
      &lt;Copy SourceFiles="@(FilesToCopy)" DestinationFolder="$(DirB)" /&gt;
    &lt;/Target&gt;
  
    &lt;Target Name="CopyFiles" DependsOnTargets="CopyToDirA;CopyToDirB"/&gt;
  </code></pre>
  
  <p>So invoking the target <code>CopyFiles</code> copies the relevant files to <code>$(DirA)</code> and <code>$(DirB)</code>, provided they are not already there and up-to-date.</p>
  
  <p>But the targets <code>CopyToDirA</code> and <code>CopyToDirB</code> look identical except one copies to <code>$(DirA)</code> and the other - to <code>$(DirB)</code>. Is it possible to unify them into one target first invoked with <code>$(DirA)</code> and then with <code>$(DirB)</code>?</p>
  
  <p>Thanks.</p>