dotnet-create-solution
Scaffold a .NET solution with src/test layout, Central Package Management, Directory.Build.props and .editorconfig for libraries or apps. Use when starting a .NET solution.
SKILL.md.claude/skills/dotnet-create-solution/SKILL.md
GitHubScaffold a new .NET solution with the standard project structure. Paths to scripts/ and templates/ are relative to this skill's directory.
Stack
dotnetSDK,.slnxsolution format, NuGet via Central Package Management (Directory.Packages.props)pwshfor the scaffold script
Steps
Ask first: solution name; Library (NuGet package, multi-target
net10.0;net9.0;net8.0) or Application (singlenet10.0); project template (classlib / webapi / worker / console / grpc); additional NuGet packagesRun the scaffold script:
pwsh scripts/New-Solution.ps1 -SolutionName <Name> -ProjectType <template> -OutputType <library|app> [-UpdatePackages]It creates the directory structure and
.slnx, generates source and test projects, strips redundant properties from the.csprojfiles, copies all templates (including the matching CI workflow), optionally updatesDirectory.Packages.propsto the latest versions, and runsdotnet build.Add any additional packages to
Directory.Packages.propsand reference them withoutVersionin the.csprojRun
dotnet buildto verify
Parameters: -SolutionName (required), -ProjectType (classlib/console/webapi/worker/grpc), -OutputType (library/app), -UpdatePackages (switch), -OutputDirectory
Templates
| File | Purpose |
|---|---|
Directory.Build.props |
Shared MSBuild: LangVersion=Latest, GenerateDocumentationFile, NoWarn; multi-target for libraries, single <TargetFramework> for apps |
Directory.Packages.props |
CPM stub with the NUnit, NUnit.Analyzers, NSubstitute, Shouldly and coverlet test packages plus Microsoft.SourceLink.GitHub |
src/Directory.Build.props |
Imports root props, sets OutputPath |
test/Directory.Build.props |
Imports root, IsPackable=false, test PackageReferences without versions, global Using NUnit.Framework |
.editorconfig |
From project-setup (templates/dotnet.editorconfig; its warning when not installed): C# style: file-scoped namespaces, primary constructors, _camelCase fields, analyzer severities |
.github/workflows/ci-library.yml |
NuGet library CI via the GravionLabs/ci reusable workflow (build, test, pack, publish) |
.github/workflows/ci-app.yml |
Application CI: dotnet build + dotnet test with test results reporter |
Constraints
.slnxformat only; avoid legacy.sln- All package versions live in
Directory.Packages.props, never in individual.csprojfiles - Generated
.csprojfiles must not repeat properties already inDirectory.Build.props - Libraries multi-target; applications use a single target framework
- The solution must build cleanly before the task is complete
- Workflows reference
GravionLabs/ciat the major tag@v<major>(today@v1), never@mainor a commit SHA; third-party actions stay SHA-pinned where the repository requires it
Report: summary, files created, verify command (dotnet build).