property-patterns
MSBuild property definition patterns: conditional defaults, composition/concatenation, path normalization, trailing-slash handling, TFM detection helpers, and evaluation order. USE FOR: diagnosing and fixing property definition issues and shared-property anti-patterns in .props/.csproj; DefineConstants or NoWarn overwritten instead of appended; unconditional assignments that block project-level overrides; unquoted conditions that fail on empty properties; hardcoded paths that break cross-platform builds; setting overridable defaults; property evaluation order and last-write-wins semantics. DO
npx skills add dotnet/skills --skill property-patterns --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# MSBuild Property Patterns Canonical property definition and manipulation patterns from the MSBuild repository. ## Conditional Defaults — The Foundational Pattern Set a property **only if not already set**, allowing callers to override: ```xml <PropertyGroup> <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration> <Platform Condition="'$(Platform)' == ''">AnyCPU</Platform> <BuildInParallel Condition="'$(BuildInParallel)' == ''">true</BuildInParallel> </PropertyGroup> ``` ### Rules - Always quote both sides: `'$(Prop)' == ''` - In `.props`: creates overridable defaults. In `.targets`: creates fallbacks. - Properties without the condition **cannot be overridden** by earlier imports. ## Nested Conditional Groups Group related properties under a shared condition: ```xml <PropertyGroup Condition="$(TargetFramework.StartsWith('net4'))"> <DefineConstants>$(DefineConstants);FEATURE_APARTMENT_STATE</DefineConstants> <DefineConstants>$(DefineConstants);FEATURE_APM</DefineConstants> <FeatureAppDomain>true</FeatureAppDomain> </PropertyGroup> <PropertyGroup Condition="'$([MSBuild]::GetTargetFrameworkIdentifier('$(TargetFramework)'))' == '.NETCoreApp'"> <NetCoreBuild>true</Net
- Conditional Defaults — The Foundational Pattern
- Rules
- Nested Conditional Groups
- Composition — Semicolon Concatenation
- Path Normalization and Trailing Slashes
- Preferred path functions
- Target Framework Detection Helpers
- Guard Properties
- Feature Gating by MSBuild Version
- Fallback Chains
- Last Write Wins — Evaluation Order
- Common Pitfalls
What does the property-patterns skill do?
MSBuild property definition patterns: conditional defaults, composition/concatenation, path normalization, trailing-slash handling, TFM detection helpers, and evaluation order. USE FOR: diagnosing and fixing property definition issues and shared-property anti-patterns in .props/.csproj; DefineConstants or NoWarn overwritten instead of appended; unconditional assignments that block project-level overrides; unquoted conditions that fail on empty properties; hardcoded paths that break cross-platform builds; setting overridable defaults; property evaluation order and last-write-wins semantics. DO
How do I install it?
Run `npx skills add dotnet/skills --skill property-patterns --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From dotnet/skills, a repository with 4,927 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.