msbuild-antipatterns

Detects and fixes common anti-patterns in MSBuild project files with BAD-to-GOOD transformations.

1|Updated Jun 1, 2026
One-click install
npx skills add https://github.com/D1ssolve/craft-agents --skill msbuild-antipatterns-d1ssolve
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: msbuild-antipatterns
Source: https://github.com/D1ssolve/craft-agents/tree/main/skills/msbuild-antipatterns
Command: npx skills add https://github.com/D1ssolve/craft-agents --skill msbuild-antipatterns-d1ssolve

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? MSBuild project files (.csproj, .props, .targets) often accumulate subtle mistakes—unquoted conditions, hardcoded paths, missing incremental build inputs, scattered package versions—that cause broken builds, slow no-op builds, and cross-platform failures. This Skill provides a numbered catalog of 21 anti-patterns so reviewers can systematically audit and clean up build files. ## Core Features & Use Cases - Anti-Pattern Catalog: 21 documented anti-patterns (AP-01 through AP-21), each with a smell, an explanation of why it is harmful, and a concrete BAD-to-GOOD XML transformation. - Severity-Ranked Checklist: A quick-reference table ordering checks by severity, from error-prone unquoted conditions down to style-level noise like restated SDK defaults. - Deep-Dive References: Detailed guidance on PrivateAssets for analyzer packages and on Inputs/Outputs attributes for incremental builds. - Use Case: When reviewing a pull request that modifies Directory.Build.props or a .csproj file, scan it against the catalog to catch issues like property conditions on TargetFramework in .props files (which silently fail for single-targeting projects) before they reach CI. ## Quick Start Review my .csproj and Directory.Build.props files for MSBuild anti-patterns and suggest fixes for each issue found.

Frequently Asked Questions about msbuild-antipatterns

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

FAQPage Schema
How do I find anti-patterns in my .csproj files?

Scan project files against the 21-entry catalog, starting with the severity-ranked checklist. High-priority checks include unquoted condition expressions, side effects during property evaluation, and hardcoded absolute paths, each with a concrete BAD-to-GOOD fix.

What are the most common MSBuild mistakes to avoid?

The most error-prone mistakes are unquoted condition comparisons, property conditions on TargetFramework inside .props files, hardcoded absolute paths, and using Exec for operations that have built-in tasks like MakeDir, Copy, and Delete.

Does this apply to non-SDK-style or legacy .NET projects?

Mostly yes, but some rules differ. Legacy non-SDK projects require explicit Compile includes, so the manual file listing anti-pattern does not apply there. F# .fsproj files also must list files explicitly in dependency order.

Why does my custom MSBuild target run on every build?

Custom targets without Inputs and Outputs attributes always execute because MSBuild cannot determine if they are up-to-date. Add Inputs and Outputs attributes and register generated files with FileWrites so dotnet clean removes them.

When should I not use this MSBuild anti-pattern catalog?

Do not use it for non-MSBuild build systems like npm, Maven, or CMake. For migrating legacy projects to SDK-style format, use the msbuild-modernization skill instead, and guard only optional imports rather than required ones.