directory-build-organization

Organize MSBuild infrastructure with Directory.Build files and Central Package Management.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Multi-project .NET repositories accumulate duplicated properties, package versions, and build logic across every .csproj file, making updates error-prone and inconsistent. This Skill guides the centralization of shared build settings into Directory.Build.props, Directory.Build.targets, Directory.Packages.props, and Directory.Build.rsp. ## Core Features & Use Cases - Centralized Build Settings: Move shared properties like Nullable, TreatWarningsAsErrors, and assembly metadata into Directory.Build.props, with correct guidance on props vs targets evaluation order. - Central Package Management (CPM): Enable ManagePackageVersionsCentrally with PackageVersion entries and GlobalPackageReference for analyzers in Directory.Packages.props. - Multi-Level Hierarchies: Chain nested Directory.Build files for src/ and test/ folders using GetPathOfFileAbove imports. - Pitfall Detection: Avoid the silent failure of $(TargetFramework) property conditions in .props files for single-targeting projects. - Use Case: A repo with 20 projects each repeating the same PropertyGroup boilerplate gets consolidated so each .csproj contains only its TargetFramework and unique PackageReferences. ## Quick Start Audit my solution's .csproj files and centralize the duplicated build settings into Directory.Build.props and Directory.Packages.props.

Frequently Asked Questions about directory-build-organization

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

FAQPage Schema
How do I centralize NuGet package versions across multiple .csproj files?▼

Enable Central Package Management by creating a Directory.Packages.props file at the repo root with ManagePackageVersionsCentrally set to true. Define PackageVersion items there and remove Version attributes from PackageReference items in individual projects.

What is the difference between Directory.Build.props and Directory.Build.targets?▼

Directory.Build.props is imported before the project file, so projects can override its values; use it for property defaults and common items. Directory.Build.targets is imported after the SDK, giving it the final say for custom targets and late-bound properties.

Why is my TargetFramework condition in Directory.Build.props not working?▼

TargetFramework is empty during .props evaluation for single-targeting projects because it is set in the project body, which evaluates later. Move the property condition to Directory.Build.targets; ItemGroup and Target conditions are not affected.

How do I use multiple Directory.Build.props files in nested folders?▼

MSBuild only auto-imports the first Directory.Build.props found walking up from the project. To chain levels, add an explicit Import using MSBuild::GetPathOfFileAbove at the top of the inner file with an Exists condition.

When should I not use Directory.Build files?▼

Avoid them for non-MSBuild build systems and single-project solutions with no shared settings. They are designed for multi-project repos with duplicated properties, not for migrating legacy projects to SDK-style format.