property-patterns

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

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? MSBuild property definitions often fail silently: unconditional assignments block project-level overrides, DefineConstants or NoWarn get overwritten instead of appended, unquoted conditions break on empty properties, and hardcoded paths fail on cross-platform builds. This Skill provides canonical patterns to diagnose and fix these property definition issues. ## Core Features & Use Cases - Conditional Defaults: Set overridable defaults using Condition="'$(Prop)' == ''" so callers can override values in .props files. - Composition and Concatenation: Append to list properties like DefineConstants and NoWarn with semicolons instead of overwriting prior values. - Path Normalization: Use NormalizePath, Path.Combine, and HasTrailingSlash to build cross-platform-safe paths. - TFM Detection and Evaluation Order: Apply GetTargetFrameworkIdentifier, IsTargetFrameworkCompatible, and last-write-wins semantics correctly. - Use Case: A shared .props file sets <DefineConstants>MY_FLAG</DefineConstants> unconditionally, wiping out constants defined by the project. This Skill shows the append pattern $(DefineConstants);MY_FLAG and explains why the unconditional assignment blocked overrides. ## Quick Start Ask the AI to review a Directory.Build.props or .csproj file for property definition anti-patterns such as overwritten DefineConstants, unquoted conditions, or non-overridable defaults.

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 overridable default property in MSBuild?▼

Set the property with a condition checking it is empty: `<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>`. Always quote both sides of the comparison. In .props files this creates an overridable default; without the condition, earlier imports cannot override the value.

How to append to DefineConstants without overwriting existing values?▼

Include the existing value when appending: `<DefineConstants>$(DefineConstants);MY_FEATURE</DefineConstants>`. MSBuild list properties use semicolons as separators. Writing only the new value drops all previously defined constants.

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

Unquoted conditions like `$(X)==true` produce invalid syntax when the property expands to an empty string. Always quote both sides of the comparison, for example `'$(X)' == 'true'`, so the expression remains valid with empty values.

Why is TargetFramework empty in my .props file?▼

For single-targeting projects, $(TargetFramework) is not yet evaluated when .props files are imported. Place TargetFramework-conditioned property groups in .targets files or the project file itself, where the value is always available.

How do I normalize paths for cross-platform MSBuild builds?▼

Use `$([MSBuild]::NormalizePath(...))` to combine and normalize paths, `$([System.IO.Path]::Combine(...))` for joining segments, and HasTrailingSlash to ensure directory trailing slashes. Avoid hardcoded absolute paths; prefer $(MSBuildThisFileDirectory).

When should I not use this property patterns skill?▼

Do not use it for props vs targets placement decisions, item operations, target structure authoring, or general MSBuild anti-patterns, which are covered by separate skills. It also does not apply to non-MSBuild build systems.