item-management

Diagnoses and fixes MSBuild item group patterns including batching, transforms, and metadata semantics.

Updated Sep 22, 2026
One-click install
npx skills add https://github.com/bytecakelake/Nurse-Scheduler --skill item-management-bytecakelake
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: item-management
Source: https://github.com/bytecakelake/Nurse-Scheduler/tree/main/.agents/plugins/dotnet-msbuild/skills/item-management
Command: npx skills add https://github.com/bytecakelake/Nurse-Scheduler --skill item-management-bytecakelake

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? MSBuild item groups are a common source of build bugs: duplicate file warnings from SDK globbing, targets running more times than expected due to cross-product batching, and Include vs Update misuse that silently breaks builds. This Skill provides canonical patterns from Microsoft.Common.CurrentVersion.targets to diagnose and correct these anti-patterns in .csproj files. ## Core Features & Use Cases - Include/Remove/Update Semantics: Clarifies when to add items, subtract items, or modify metadata on existing items without re-adding them. - Batching and Transforms: Explains %(Metadata) batching at target and task level, @(Item->'expression') transforms, and per-item filtering with Condition. - Pitfall Diagnosis: Covers cross-product batching, generated files polluting the source tree, and missing FileWrites registration that breaks dotnet clean. - Use Case: A build logs CS2002 duplicate file warnings after SDK globbing picks up generated files. Use this Skill to move generation to IntermediateOutputPath and apply Remove/Update correctly instead of re-including items. ## Quick Start Review my .csproj file and fix the item group that causes duplicate Compile items and a target running once per configuration instead of once total.

Frequently Asked Questions about item-management

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix CS2002 duplicate file warnings in MSBuild?▼

CS2002 warnings occur when SDK globbing includes files that are also explicitly included or generated into the source tree. Move generated files to IntermediateOutputPath (obj/) and use Remove to exclude duplicates rather than re-including items.

What is the difference between Include, Remove, and Update in MSBuild?▼

Include adds new items with identity and metadata, Remove subtracts items matching a pattern, and Update modifies metadata on items already in the group. Update never adds items, so misusing it on SDK-globbed items is a common mistake.

Why does my MSBuild target run more times than expected?▼

Referencing %(Metadata) from two different item groups in one expression creates a cross-product, causing O(N×M) executions. Reference one group via batching and pass the other through a property instead.

How does MSBuild batching with %(Metadata) work?▼

When %(Metadata) appears in a target's Outputs or Condition, the target batches once per unique metadata value; in task parameters, the task batches per unique value. Transforms like @(Item->'%(Filename)') apply an expression to each item.

Why are my generated files not deleted by dotnet clean?▼

Files created during a target must be added to the @(FileWrites) item group for dotnet clean to remove them. Also write generated files to IntermediateOutputPath rather than the source directory to avoid version control pollution.

When should I not use this item management guidance?▼

This Skill covers item group semantics only, not target chain architecture, property patterns, or incremental build design. It also does not apply to non-MSBuild build systems such as CMake or Bazel.