Cause:
This condition:
!$([System.String]::Copy('%(Identity)').EndsWith('.resources.dll'))
returns a string, not a Boolean, which MSBuild expects.
Why:
%(Identity) only works inside <ItemGroup> iterations — not with static paths.
✅
Fix It
Option 1 – Use in ItemGroup:
<ItemGroup>
<MyAssemblies Include="@(ReferencePath)">
<IsNotResource>$([System.String]::Copy('%(Identity)').EndsWith('.resources.dll'))</IsNotResource>
</MyAssemblies>
</ItemGroup>
Option 2 – Use Property for Static Path:
<PropertyGroup>
<MyFilePath>Path\To\Your.dll</MyFilePath>
</PropertyGroup>
<SomeElement Condition="!$([System.String]::Copy('$(MyFilePath)').EndsWith('.resources.dll'))">