msbuild-antipatterns

Detect and fix common anti-patterns in MSBuild project and build files.

Updated Jul 20, 2026
One-click install
npx skills add https://github.com/Netcodr81/kinetic-reports --skill msbuild-antipatterns-netcodr81
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: msbuild-antipatterns
Source: https://github.com/Netcodr81/kinetic-reports/tree/main/.github/skills/msbuild-antipatterns
Command: npx skills add https://github.com/Netcodr81/kinetic-reports --skill msbuild-antipatterns-netcodr81

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? MSBuild project files (.csproj, .props, .targets) often accumulate subtle authoring mistakes—unquoted conditions, hardcoded paths, missing incremental-build metadata, redundant references—that cause broken builds, slow no-op builds, race conditions, and cross-platform failures. This Skill provides a numbered catalog of 23 anti-patterns, each with a symptom, an explanation of why it is harmful, and a concrete BAD-to-GOOD fix. ## Core Features & Use Cases - Anti-Pattern Detection: Scan .csproj, .vbproj, .fsproj, .props, .targets, and Directory.Build.props/.targets files for 23 cataloged issues, each rated by severity (error-prone, legacy, performance, style). - Concrete Fixes: Every anti-pattern includes a BAD/GOOD XML pair showing the exact transformation, such as replacing <Exec> shell calls with built-in tasks or adding Inputs/Outputs to custom targets. - Deep-Dive References: Supplementary references cover incremental build Inputs/Outputs with FileWrites registration and PrivateAssets rules for analyzer packages. - Use Case: A developer asks "is this project file correct?" or "why does my build fail intermittently in CI?"—the Skill identifies issues like AP-22 project-instance forking or AP-21 TargetFramework conditions in .props files that silently fail for single-targeting projects. ## Quick Start Review my Directory.Build.props and all .csproj files in this repo for MSBuild anti-patterns and suggest fixes.

Frequently Asked Questions about msbuild-antipatterns

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

FAQPage Schema
How do I review a .csproj file for common MSBuild mistakes?▼

Scan the project file against the anti-pattern catalog: check for unquoted conditions, hardcoded absolute paths, manual Compile listings in SDK-style projects, Reference with HintPath instead of PackageReference, and copy-pasted PropertyGroups that belong in Directory.Build.props. Each finding maps to a concrete BAD-to-GOOD fix.

Why does my MSBuild target run on every build even when nothing changed?▼

The custom target is missing Inputs and Outputs attributes, so MSBuild cannot determine it is up-to-date. Add Inputs including $(MSBuildProjectFile) and Outputs pointing to files under $(IntermediateOutputPath), and register generated files in FileWrites so dotnet clean removes them.

Why does my build fail intermittently with file-in-use errors in parallel builds?▼

This is typically a forked project instance: an <MSBuild> task call or SetTargetFramework metadata passes a path-neutral global property, creating a second instance of the same project that shares the same bin/obj output path. Both instances write the same files concurrently, causing file-lock failures.

Do backslashes in MSBuild Import paths break on Linux or macOS?▼

No for Import paths—MSBuild's evaluator normalizes backslashes to forward slashes on Unix, so it is only a style issue. Backslashes are a real error only in raw shell strings passed to <Exec> or other non-MSBuild consumers, where bash treats them as escape characters.

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

Do not use it for non-MSBuild build systems like npm, Maven, or CMake, and do not use it for migrating legacy projects to SDK-style format—that scenario belongs to a dedicated modernization skill. It also does not apply to F# file ordering, which legitimately requires explicit Compile listings.