title: How to access ItemGroup Metadata as properties within MSBuild script
body: <p>Is it possible using default MSBuild technology to access a listing within an item group as a property in msbuild?  I know I can do this in a custom task in C#, but I am trying to use built-in capabilities if possible.</p>
  
  <p>Example:</p>
  
  <p>I have an item group:</p>
  
  <pre><code>&lt;ItemGroup&gt;
      &lt;SolutionToBuild Include="$(SolutionRoot)\Solutions\ClassLib\ClassLib.sln"&gt;
        &lt;Properties&gt;
          AssemblySigningKey=MySigningKey;
          OutDir=$(BinariesRoot)\SomeLocation\;
          LibraryName=ClassLib;
          PlatformTarget=x86;
        &lt;/Properties&gt;
      &lt;/SolutionToBuild&gt;
  
      &lt;SolutionToBuild Include="$(SolutionRoot)\Solutions\BLAH\BLAH.sln"&gt;
        &lt;Properties&gt;
          ProjectType=Web;
        &lt;/Properties&gt;
      &lt;/SolutionToBuild&gt;
  &lt;/ItemGroup&gt;
  </code></pre>
  
  <p>I would like to extract the value of <code>AssemblySigningKey</code>, if it exists, and place this value into an MSBuild variable.</p>
  
  <p>I have tried a few methods and the closest example I could find is using a tranformation within a separate target, but even this looks to be a bit of a hack, even if I could get the <code>Condition</code> to work I would then have to parse out the value splitting on the <code>=</code>.  Is there no standard method to access this metadata within the item group? </p>
  
  <pre><code>&lt;Target Name="TransformProps"
          Inputs="%(SolutionToBuild.Identity)"
          Outputs="_Non_Existent_Item_To_Batch_"&gt;
  
      &lt;PropertyGroup&gt;
          &lt;IncludeProps&gt;%(SolutionToBuild.Properties)&lt;/IncludeProps&gt;
      &lt;/PropertyGroup&gt;
  
      &lt;ItemGroup&gt;
          &lt;IncludeProps Include="$(IncludeProps)" /&gt;
          &lt;Solution Include="@(SolutionToBuild)"&gt;
            &lt;IncludeProps Condition="'True'=='True' "&gt;@(IncludeProps -&gt;'-PROP %(Identity)', ' ')&lt;/IncludeProps&gt;
  
          &lt;/Solution&gt;
      &lt;/ItemGroup&gt;
  &lt;/Target&gt;
  </code></pre>
  
  <p>My main target would call into the tranform in the following manner:</p>
  
  <pre><code>&lt;Target Name="Main"  DependsOnTargets="TransformProps"&gt;    
      &lt;Message Text="Solution info:  %(Solution.Identity) %(Solution.IncludeProps)" /&gt;
  &lt;/Target&gt;
  </code></pre>