msbuild-antipatterns

Detect and remediate MSBuild antipatterns in .NET project files.

2|Updated Mar 17, 2026
One-click install
npx skills add https://github.com/sayedihashimi/copilot-skill-eval --skill msbuild-antipatterns-sayedihashimi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: msbuild-antipatterns
Source: https://github.com/sayedihashimi/copilot-skill-eval/tree/main/examples/aspnet-razor-pages/plugins/dotnet-skills/dotnet-msbuild/skills/msbuild-antipatterns
Command: npx skills add https://github.com/sayedihashimi/copilot-skill-eval --skill msbuild-antipatterns-sayedihashimi

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Catalog of MSBuild antipatterns with detection rules and fix recipes. It helps teams review and clean up MSBuild projects by identifying common mistakes that degrade build quality and maintainability.

Core Features & Use Cases

  • Detects common MSBuild antipatterns such as Exec-instead-of-built-in-task, unquoted conditions, hardcoded paths, restating SDK defaults, and scattered package versions.
  • Provides BAD→GOOD transformations and practical guidance for projects (.csproj, .vbproj, .fsproj, .props, .targets, or .proj files).
  • Serves as a reference during audits and refactoring to improve reliability and readability of build configurations.

Quick Start

Review your MSBuild projects to identify and replace anti-patterns with recommended fixes to ensure cleaner, more maintainable builds.

Frequently Asked Questions about msbuild-antipatterns

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

FAQPage Schema
What are common MSBuild antipatterns in .NET projects?

MSBuild antipatterns include using Exec operations instead of built-in tasks, unquoted conditions, hardcoded paths, restating SDK defaults, and scattered package versions across .csproj, .vbproj, or .fsproj files. These degrade build reliability and maintainability.

How do I fix unquoted conditions in my MSBuild project files?

Fix unquoted conditions in MSBuild project files by applying BAD to GOOD transformations that properly quote condition strings, preventing build errors and improving reliability across SDK-style and legacy .csproj, .vbproj, and .fsproj files.

Can I scan legacy csproj files for MSBuild antipatterns?

Yes, MSBuild antipattern detection applies to both SDK-style and legacy .csproj, .vbproj, and .fsproj files. It also covers .props, .targets, and .proj files across large codebases for comprehensive build configuration audits.

What's the best way to detect hardcoded paths in MSBuild targets?

The best way to detect hardcoded paths in MSBuild targets is to review project files against antipattern rules AP-01 through AP-21, which identify hardcoded paths and provide BAD to GOOD refactoring transformations for cleaner builds.

Does MSBuild antipattern detection work with .props and .targets files?

Yes, MSBuild antipattern detection works with .props and .targets files. It also supports .csproj, .vbproj, .fsproj, and .proj files, identifying non-idiomatic Targets and other build configuration issues for refactoring.

Why should I replace Exec-based operations in MSBuild with built-in tasks?

You should replace Exec-based operations in MSBuild with built-in tasks because Exec operations are a recognized antipattern that degrades build reliability. Built-in tasks provide better maintainability and integrate more cleanly with the MSBuild pipeline.