title: Why is MsBuild's ItemGroup->EndWith not working for '.exe'?
body: <p>I'm trying to make an item group of dll's and exe's but filtering out any msi's and test.dll's.</p>
  
  <p>The following snippet doesn't include the .exe in the UniqueAssemblies itemgroup. It does contain all the dll's and removes the msi as expected though. UniqueCompiledFiles does contain all the expected output files (.test.dll, .dll, .msi, .exe)</p>
  
  <pre><code>&lt;Target Name="CustomCompile"&gt;
  &lt;MSBuild
    BuildInParallel="true"
    Projects="@(ProjectFiles)"
    Properties="$(ProjectProperties)"
  &gt;
    &lt;Output TaskParameter="TargetOutputs" ItemName="CompiledFiles" /&gt;
  &lt;/MSBuild&gt;
  &lt;RemoveDuplicates Inputs="@(CompiledFiles)"&gt;
    &lt;Output TaskParameter="Filtered" ItemName="UniqueCompiledFiles" /&gt;
  &lt;/RemoveDuplicates&gt;
  
  &lt;ItemGroup&gt;
    &lt;UniqueAssemblies
      Include="%(UniqueCompiledFiles.Identity)"
      Condition=" '@(UniqueCompiledFiles-&gt;EndsWith('.dll'))' == 'true' " /&gt;
    &lt;UniqueAssemblies
      Include="%(UniqueCompiledFiles.Identity)"
      Condition=" '@(UniqueCompiledFiles-&gt;EndsWith('.exe'))' == 'true' " /&gt;
  &lt;/ItemGroup&gt;
  </code></pre>
  
  <p>I also figured out this workaround that does properly filter the .exe. </p>
  
  <pre><code>&lt;ItemGroup&gt;
    &lt;UniqueAssemblies2
        Include="%(UniqueCompiledFiles.Identity)"
        Condition=" $([System.String]::new('%(UniqueCompiledFiles.Identity)').EndsWith('.exe')) " /&gt;
  &lt;/ItemGroup&gt;
  </code></pre>
  
  <p>Found out the culprit lines that could be removed to fix the problem but it doesn't actually answer the question. </p>
  
  <pre><code>&lt;ItemGroup&gt;
    &lt;!-- Workaround for MSBuild defect: https://github.com/Microsoft/msbuild/issues/69 --&gt;
    &lt;UniqueCompiledFiles Include="Project\bin\release\Project.exe"&gt;
      &lt;MSBuildSourceProjectFile&gt;Project\Project.csproj&lt;/MSBuildSourceProjectFile&gt;
      &lt;Platform&gt;x86&lt;/Platform&gt;
    &lt;/UniqueCompiledFiles&gt;
  &lt;/ItemGroup&gt;
  </code></pre>
  
  <p>Why is the <code>@(UniqueCompiledFiles-&gt;EndsWith('.exe'))</code> syntax not working as expected?</p>