Filter ItemGroup by extension in MSBuild

November 4, 2020msbuild

Just a quick snippet that shows how to filter an exiting ItemGroup by an extension.

    <FilteredItems Include="@(None)" Condition="'%(Extension)' == '.ext'" />

None is the name of the ItemGroup you'd like to filter and you need to change the extension to the file extension you are looking for.