property-patterns

Diagnoses and fixes MSBuild property definition patterns in .props and .csproj files.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? MSBuild properties are frequently misconfigured: defaults that cannot be overridden, DefineConstants or NoWarn values overwritten instead of appended, unquoted conditions that fail on empty properties, and hardcoded paths that break cross-platform builds. This Skill provides canonical patterns to diagnose and fix these property definition issues. ## Core Features & Use Cases - Conditional Defaults: Set overridable property defaults using Condition="'$(Prop)' == ''" so callers can override values. - Composition and Concatenation: Append to list properties like DefineConstants and NoWarn with semicolons instead of overwriting them. - Path Normalization: Handle trailing slashes, cross-platform paths, and relative-to-absolute conversion using MSBuild property functions. - TFM Detection and Evaluation Order: Use GetTargetFrameworkIdentifier, IsTargetFrameworkCompatible, and guard properties, while respecting last-write-wins evaluation semantics. - Use Case: A shared Directory.Build.props sets <DefineConstants>MY_FLAG</DefineConstants> unconditionally, wiping out project-level constants. This Skill rewrites it to append with $(DefineConstants);MY_FLAG and adds proper conditions. ## Quick Start Review my Directory.Build.props file and fix any property definitions that overwrite values instead of appending or that cannot be overridden by individual projects.

Frequently Asked Questions about property-patterns

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

FAQPage Schema
How do I set an MSBuild property default that projects can override?

Set the property with a condition checking it is empty: `<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>`. Always quote both sides of the comparison so the condition works when the property is unset.

How do I append to DefineConstants without overwriting existing values?

Include the existing value in the assignment: `<DefineConstants>$(DefineConstants);MY_FEATURE</DefineConstants>`. Writing only the new constant drops all previously defined constants, which is a common MSBuild anti-pattern.

Why does my MSBuild condition fail when the property is empty?

Unquoted conditions like `$(X)==true` produce invalid syntax when the property is empty. Always quote both sides of the comparison, for example `'$(X)' == 'true'`, so empty values evaluate safely.

Can I use TargetFramework conditions in .props files?

TargetFramework is empty in .props files for single-targeting projects until the project body is evaluated. Place TargetFramework-conditioned property groups in .targets files or the project file itself, where the value is always available.

How do I make MSBuild paths work cross-platform?

Use `$([MSBuild]::NormalizePath(...))` to combine and normalize paths, `$(MSBuildThisFileDirectory)` for paths relative to the current file, and HasTrailingSlash to ensure directory paths end with a slash. Avoid hardcoded absolute paths.

When should I not use this MSBuild property patterns skill?

Do not use it for deciding props versus targets file placement, item operations, target authoring, or general MSBuild anti-patterns, since dedicated skills cover those areas. It also does not apply to non-MSBuild build systems.