item-management
Patterns for managing MSBuild item groups: Include/Remove/Update semantics, item metadata, batching with %(Metadata), transforms, per-item filtering, and cross-product batching pitfalls. USE FOR: diagnosing and fixing item group anti-patterns in .csproj files, reviewing item management for correctness, fixing CS2002 duplicate file warnings from SDK globbing, fixing targets that run more times than expected due to cross-product batching, fixing Include vs Update misuse on SDK-globbed items, fixing FileWrites registration for generated file clean support, moving generated files to IntermediateOu
npx skills add dotnet/skills --skill item-management --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# MSBuild Item Management Patterns Canonical patterns for working with item groups, from `Microsoft.Common.CurrentVersion.targets`. ## Include / Remove / Update — Three Operations | 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 | ### Include — Add Items ```xml <ItemGroup> <Compile Include="Generated\*.cs"> <AutoGen>true</AutoGen> </Compile> </ItemGroup> ``` ### Remove — Subtract Items ```xml <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> ``` ### Update — Modify Existing Items ```xml <ItemGroup> <EmbeddedResource Update="@(EmbeddedResource)" Condition="'%(NuGetPackageId)' == 'Microsoft.CodeAnalysis.Collections'"> <GenerateSource>true</Genera
- Include / Remove / Update — Three Operations
- Include — Add Items
- Remove — Subtract Items
- Update — Modify Existing Items
- Item Batching — %(Metadata)
- Target-level batching (Outputs)
- Task-level batching
- Per-item filtering with Condition
- Batching rules
- Item Transforms — @(Item->'expression')
- Exclude Pattern — Set Subtraction on Include
- Conditional Item Inclusion
- PrivateAssets on Tool/Analyzer Packages
- Common Pitfalls
What does the item-management skill do?
Patterns for managing MSBuild item groups: Include/Remove/Update semantics, item metadata, batching with %(Metadata), transforms, per-item filtering, and cross-product batching pitfalls. USE FOR: diagnosing and fixing item group anti-patterns in .csproj files, reviewing item management for correctness, fixing CS2002 duplicate file warnings from SDK globbing, fixing targets that run more times than expected due to cross-product batching, fixing Include vs Update misuse on SDK-globbed items, fixing FileWrites registration for generated file clean support, moving generated files to IntermediateOu
How do I install it?
Run `npx skills add dotnet/skills --skill item-management --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From dotnet/skills, a repository with 4,927 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.