property-patterns

Diagnose and fix MSBuild property definition patterns in .props and .csproj files.

Updated Sep 22, 2026
One-click install
npx skills add https://github.com/bytecakelake/Nurse-Scheduler --skill property-patterns-bytecakelake
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: property-patterns
Source: https://github.com/bytecakelake/Nurse-Scheduler/tree/main/.agents/plugins/dotnet-msbuild/skills/property-patterns
Command: npx skills add https://github.com/bytecakelake/Nurse-Scheduler --skill property-patterns-bytecakelake

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? MSBuild property bugs are subtle: unconditional assignments block project-level overrides, DefineConstants gets overwritten instead of appended, unquoted conditions fail on empty properties, and hardcoded paths break cross-platform builds. This Skill provides canonical patterns from the MSBuild repository to diagnose and fix these property definition issues. ## Core Features & Use Cases - Conditional Defaults: Set overridable defaults with Condition="'$(Prop)' == ''" so callers can override values in .props files. - Composition & Concatenation: Append to list properties like DefineConstants and NoWarn using semicolon concatenation instead of overwriting. - Path Normalization: Handle trailing slashes, cross-platform paths, and relative-to-absolute conversion with NormalizePath and Path.Combine. - TFM Detection & Evaluation Order: Use GetTargetFrameworkIdentifier, IsTargetFrameworkCompatible, and guard properties, while respecting last-write-wins semantics. - Use Case: Your shared .props file sets DefineConstants unconditionally and wipes out project-level constants. Use this Skill to rewrite it with proper append semantics and conditional defaults. ## Quick Start Review my Directory.Build.props file and fix any property definitions that overwrite DefineConstants or block project-level overrides.

Frequently Asked Questions about property-patterns

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

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

Set the property with a condition checking it is empty: Condition="'$(Configuration)' == ''" with a default value. In .props files this creates an overridable default; without the condition, earlier imports cannot override the value.

How to append to DefineConstants in MSBuild without overwriting?▼

Include the existing value when appending: <DefineConstants>$(DefineConstants);MY_FEATURE</DefineConstants>. Writing <DefineConstants>MY_CONST</DefineConstants> alone drops all previously defined constants from earlier imports.

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

Unquoted conditions like $(X)==true fail or misbehave when the property is empty. Always quote both sides of the comparison, for example Condition="'$(X)' == 'true'", so empty values evaluate predictably.

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 body, where the value is always available.

How do I make MSBuild paths work cross-platform?▼

Use $([MSBuild]::NormalizePath(...)) to combine and normalize paths, $([System.IO.Path]::Combine(...)) for segments, and HasTrailingSlash to enforce trailing slashes on directories. 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. It also does not apply to non-MSBuild build systems such as CMake or Bazel.