title: Can I cache ItemGroup with metadata?
body: <p>Assume I have a ItemGroup with metadata that takes some times to build (10 seconds):</p>
  
  <pre><code>&lt;Target Name="BuildItemGroup"&gt;
      &lt;ItemGroup&gt;
          &lt;File Include="5"&gt;
              &lt;Value&gt;5a&lt;/Value&gt;
          &lt;/File&gt;
          &lt;File Include="4"&gt;
              &lt;Value&gt;4a&lt;/Value&gt;
          &lt;/File&gt;
          ...
      &lt;/ItemGroup&gt;
      &lt;Message Text="Wait 10 seconds..." Importance="High" /&gt;
  &lt;/Target&gt;
  </code></pre>
  
  <p>And I am going to use the same ItemGroup few times in a recursive MSBuild task:</p>
  
  <pre><code>&lt;Target Name="Recursive" DependsOnTargets="BuildItemGroup" Condition="$(Value) &gt; 0" &gt;
      &lt;PropertyGroup&gt;
          &lt;Value&gt;$([MSBuild]::Subtract($(Value), 1))&lt;/Value&gt;
      &lt;/PropertyGroup&gt;
  
      &lt;MSBuild Projects="$(MSBuildProjectFile)" Targets="Recursive" Properties="Value=$(Value)" /&gt;
  &lt;/Target&gt;
  
  &lt;PropertyGroup&gt;
     &lt;Value&gt;5&lt;/Value&gt;
  &lt;/PropertyGroup&gt;
  
  &lt;Target Name="Default" DependsOnTargets="Recursive" /&gt;
  </code></pre>
  
  <p>It will takes extra 40 seconds finish the <code>Recursive</code> task for 4 loops.  Is there a way to cache the ItemGroup in such manner for loop usage?</p>