dotnet-project-structure

Standardizes .NET project structures with centralized configs, SDK pinning, and .slnx format.

3|Updated Jan 24, 2024
One-click install
npx skills add https://github.com/akoken/dotfiles --skill dotnet-project-structure-akoken
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dotnet-project-structure
Source: https://github.com/akoken/dotfiles/tree/main/config/.copilot/skills/dotnet-project-structure
Command: npx skills add https://github.com/akoken/dotfiles --skill dotnet-project-structure-akoken

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill standardizes and modernizes .NET project structures by introducing centralized configuration (Directory.Build.props and Directory.Packages.props), a modern .slnx solution format, and SDK pinning with global.json to ensure reproducible builds across multiple projects.

Core Features & Use Cases

  • Centralized build and package management with Directory.Build.props and Directory.Packages.props for consistent properties and versions across projects.
  • Modern solution workflow: .slnx files and guidance for migrations from .sln to slnx.
  • SDK pinning and toolchain stability via global.json.
  • Package and source tooling: SourceLink integration and RELEASE_NOTES.md for release management.
  • Use Case: Setting up a multi-project solution with consistent dependencies and straightforward release cycles.

Quick Start

Create a new repository structure with a solution and central props/packages files, pin the SDK, enable SourceLink configurations, and generate a .slnx-based solution using the .NET CLI. Initialize Directory.Build.props at the solution root to define common properties, and Directory.Packages.props to centralize package versions. Add a global.json to pin the .NET SDK version, generate a .slnx with dotnet new sln --format slnx and add your projects, and maintain a RELEASE_NOTES.md to track releases.

Frequently Asked Questions about dotnet-project-structure

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

FAQPage Schema
How do I centralize package versions across multiple .NET projects?

To centralize package versions across .NET projects, add a Directory.Packages.props file at your solution root. This file defines all NuGet versions in one location, ensuring consistent dependencies across every project without individual version management.

What is the .slnx solution format and how do I generate it?

The .slnx solution format is a modern, XML-based alternative to traditional .sln files for .NET projects. You can generate it using the command dotnet new sln --format slnx, which creates a streamlined solution file to manage your projects.

How do I share common MSBuild properties across projects in a solution?

You can share common MSBuild properties across projects by creating a Directory.Build.props file at the solution root. This centralized configuration file automatically applies shared build properties and settings to every project underneath it.

Why do I need global.json for SDK pinning in .NET builds?

You need global.json for SDK pinning to enforce reproducible builds across different environments. By pinning the .NET SDK version in this file, you ensure all developers and CI pipelines use the exact same toolchain, preventing unexpected build failures from SDK updates.

Does this centralized configuration approach work for multi-project .NET solutions?

Yes, this centralized configuration approach is specifically designed for multi-project .NET solutions. It standardizes cross-project property sharing, enforces consistent version control, and simplifies release-driven version management across all included projects.

How do I enable SourceLink debugging in a centralized .NET project structure?

To enable SourceLink debugging in a centralized .NET project structure, you configure SourceLink integration within your Directory.Build.props file. This setup provides source control metadata for your binaries, allowing automatic source downloads during debugging sessions.