| name | dotnet-scaffold-project |
| description | Creates a new .NET project. Generates solution with CPM, analyzers, editorconfig, SourceLink. |
| license | MIT |
| targets | ["*"] |
| category | developer-experience |
| subcategory | project |
| tags | ["tooling","dotnet","skill","project","scaffolding"] |
| version | 1.0.0 |
| author | dotnet-agent-harness |
| invocable | true |
| related_skills | ["dotnet-project-structure","dotnet-project-analysis","dotnet-version-detection"] |
| claudecode | {"allowed-tools":["Read","Grep","Glob","Bash","Write","Edit"]} |
| codexcli | {"short-description":".NET skill guidance for project tasks"} |
| opencode | {"allowed-tools":["Read","Grep","Glob","Bash","Write","Edit"]} |
| copilot | {} |
| geminicli | {} |
| antigravity | {} |
dotnet-scaffold-project
Scaffolds a new .NET project with all modern best practices applied. Generates the full solution structure including
Central Package Management, analyzers, .editorconfig, SourceLink, and deterministic builds.
Prerequisites: Run [skill:dotnet-version-detection] first to determine available SDK version — this affects which
features and templates are available.
Scope
- Full solution structure generation (src/, tests/, .sln)
- Central Package Management and Directory.Build.props
- Analyzers, .editorconfig, SourceLink, deterministic builds
Out of scope
- Solution layout rationale and conventions -- see [skill:dotnet-project-structure]
- Analyzer configuration details -- see [skill:dotnet-add-analyzers]
- CI workflow generation -- see [skill:dotnet-add-ci]
Cross-references: [skill:dotnet-project-structure] for layout rationale, [skill:dotnet-add-analyzers] for analyzer
configuration, [skill:dotnet-add-ci] for adding CI after scaffolding.
Step 1: Create Solution Structure
Create the directory layout and solution file.
mkdir -p MyApp/src MyApp/tests
cd MyApp
dotnet new sln -n MyApp
dotnet sln MyApp.sln migrate
```text
Select the appropriate template based on the application type:
| Template | Command | SDK |
|----------|---------|-----|
| Web API (minimal) | `dotnet new webapi -n MyApp.Api -o src/MyApp.Api` | `Microsoft.NET.Sdk.Web` |
| Web API (controllers) | `dotnet new webapi -n MyApp.Api -o src/MyApp.Api --use-controllers` | `Microsoft.NET.Sdk.Web` |
| Console app | `dotnet new console -n MyApp.Cli -o src/MyApp.Cli` | `Microsoft.NET.Sdk` |
| Worker service | `dotnet new worker -n MyApp.Worker -o src/MyApp.Worker` | `Microsoft.NET.Sdk.Worker` |
| Class library | `dotnet new classlib -n MyApp.Core -o src/MyApp.Core` | `Microsoft.NET.Sdk` |
| Blazor web app | `dotnet new blazor -n MyApp.Web -o src/MyApp.Web` | `Microsoft.NET.Sdk.Web` |
| MAUI app | `dotnet new maui -n MyApp.Mobile -o src/MyApp.Mobile` | `Microsoft.Maui.Sdk` |
| xUnit test | `dotnet new xunit -n MyApp.Tests -o tests/MyApp.Tests` | `Microsoft.NET.Sdk` |
```bash
dotnet new classlib -n MyApp.Core -o src/MyApp.Core
dotnet new webapi -n MyApp.Api -o src/MyApp.Api
dotnet new xunit -n MyApp.UnitTests -o tests/MyApp.UnitTests
dotnet sln add src/MyApp.Core/MyApp.Core.csproj
dotnet sln add src/MyApp.Api/MyApp.Api.csproj
dotnet sln add tests/MyApp.UnitTests/MyApp.UnitTests.csproj
dotnet add src/MyApp.Api/MyApp.Api.csproj reference src/MyApp.Core/MyApp.Core.csproj
dotnet add tests/MyApp.UnitTests/MyApp.UnitTests.csproj reference src/MyApp.Core/MyApp.Core.csproj
```csharp
---
Pin the SDK version reproducible builds.
```json
{
: {
: ,
:
}
}
```text
Adjust the version to match the output of `dotnet --version`.
---
Create at the repo root to share build settings across all projects.
```xml
<Project>
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<LangVersion>14</LangVersion>
<Nullable></Nullable>
<ImplicitUsings></ImplicitUsings>
<TreatWarningsAsErrors></TreatWarningsAsErrors>
<EnforceCodeStyleInBuild></EnforceCodeStyleInBuild>
<AnalysisLevel>latest-all</AnalysisLevel>
</PropertyGroup>
<!-- Deterministic builds and SourceLink ( libraries) -->
<PropertyGroup>
<PublishRepositoryUrl></PublishRepositoryUrl>
<EmbedUntrackedSources></EmbedUntrackedSources>
<DebugType>embedded</DebugType>
<ContinuousIntegrationBuild Condition=></ContinuousIntegrationBuild>
</PropertyGroup>
<!-- NuGet audit -->
<PropertyGroup>
<NuGetAudit></NuGetAudit>
<NuGetAuditLevel>low</NuGetAuditLevel>
<NuGetAuditMode>all</NuGetAuditMode>
<RestorePackagesWithLockFile></RestorePackagesWithLockFile>
</PropertyGroup>
</Project>
```text
After creating this, **remove** `<TargetFramework>`, `<Nullable>`, and `<ImplicitUsings>` from individual `.csproj` files to avoid duplication.
```xml
<!-- tests/Directory.Build.props -->
<Project>
<Import Project= />
<PropertyGroup>
<IsPackable></IsPackable>
<IsTestProject></IsTestProject>
<!-- Use Microsoft.Testing.Platform v2 runner (requires Microsoft.NET.Test.Sdk 17.13+/18.x) -->
<UseMicrosoftTestingPlatformRunner></UseMicrosoftTestingPlatformRunner>
<!-- Tests donVersion=