Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Documents MSBuild item group patterns for diagnosing and fixing .csproj item anti-patterns, like CS2002 duplicate-file warnings.
95% 100%+5 ptsof test cases passed
Passed 22 of 22 test cases with the skill, and 21 of 22 without it.
A developer wrote `<EmbeddedResource Update="@(EmbeddedResource)" Exclude="*.resx" />` expecting MSBuild to skip updating `.resx` files. Why does this fail or fail to exclude items in MSBuild?
Explains that the Exclude attribute is supported only on Include operations
3 of 3 safety checks passed
Canonical patterns for working with item groups, from Microsoft.Common.CurrentVersion.targets.
| Operation | Purpose | When to use |
|---|---|---|
Include | Add new items to the group | Creating items with identity + metadata |
Remove | Remove items matching a pattern | Excluding files or clearing a group |
Update | Modify metadata on existing items | Adding/changing metadata without re-adding |
<ItemGroup>
<Compile Include="Generated\*.cs">
<AutoGen>true</AutoGen>
</Compile>
</ItemGroup>
<ItemGroup>
<!-- Remove specific items -->
<Reference Remove="$(AdditionalExplicitAssemblyReferences)" />
<!-- Set subtraction: prior minus current -->
<_CleanOrphanFileWrites Include="@(_CleanPriorFileWrites)"
Exclude="@(_CleanCurrentFileWrites)" />
<!-- Clear an entire group -->
<_Temporary Remove="@(_Temporary)" />
</ItemGroup>
Next to this one in the catalogue, plus more from the same author.