title: msbuild: How to extract items without metadata?
body: <p>From a msbuild "Item", I want to to extract all those members that have no metadata (please forgive me if I am using wrong terminology).</p>
  
  <p>This is my background: I am preparing files for creation of an installation package. The files that should go into the package are defined in an "Item" like this:</p>
  
  <pre><code>&lt;ItemGroup&gt;
    &lt;Files Include="readme.txt" /&gt;
    &lt;Files Include="myfile.txt"&gt;
      &lt;Rename&gt;help.txt&lt;/Rename&gt;
    &lt;/Files&gt;
    &lt;Files Include="changes.log" /&gt;
    &lt;!-- more files --&gt;
  &lt;/ItemGroup&gt;
  </code></pre>
  
  <p>While readme.txt should be included as-is, myfile.txt should be renamed into help.txt because someone decided that myfile.txt is a poor name.
  I created a sequence (inside a Target) that renames files that have the "Rename" metadata.</p>
  
  <pre><code>&lt;ItemGroup&gt;
    &lt;FilesToRename Include="@(ChangeLogs-&gt;HasMetadata('Rename'))"/&gt;
  &lt;/ItemGroup&gt;
  &lt;Move SourceFiles="@(FilesToRename-&gt;'$(WorkDir)\source\%(Identity)')" DestinationFiles="@(FilesToRename-&gt;'$(WorkDir)\source\%(Rename)')" /&gt;
  </code></pre>
  
  <p>For copying those files into the installation package, I need an item that consists of the "Rename" names for renamed files, and original names for the others; in this example, "readme.txt;help.txt;changes.log" (in any order). My first attempt was to use "FilesToRename" from above, and add the "inverted" expression like this:</p>
  
  <pre><code>&lt;FilesToCopy Include="@(FilesToRename-&gt;'%(Rename)')" /&gt;
  &lt;FilesToCopy Include="@(Files-&gt;Not HasMetadata('Rename'))" /&gt;
  </code></pre>
  
  <p>but that is not expanded. Neither could I make a "Condition" work, like</p>
  
  <pre><code>&lt;FilesToCopy Include="@(Files)" Condition="Not @(Files-&gt;HasMetadata('Rename'))/&gt;
  </code></pre>
  
  <p>which only results in a syntax error "An unexpected token was found".</p>
  
  <p>Any ideas would be appreciated.</p>
  
  <p>Thanks
  Hans</p>