// Essential .NET CLI commands and patterns for .NET 10 projects with Directory.Build.props and .slnx solutions
| name | dotnet-cli-essentials |
| description | Essential .NET CLI commands and patterns for .NET 10 projects with Directory.Build.props and .slnx solutions |
| type | domain |
| enforcement | suggest |
| priority | medium |
This skill provides guidance for using the .NET CLI in this .NET 10 project. Covers common commands for building, running, testing, and managing projects.
/
โโโ global.json # SDK version pin
โโโ Directory.Build.props # Shared MSBuild properties
โโโ Directory.Packages.props # Centralized package versions
โโโ sln.slnx # XML-based solution file
โโโ src/
โ โโโ ClaudeStack.Web/ # ASP.NET Core MVC
โ โโโ ClaudeStack.API/ # Minimal API
โโโ tests/
โโโ ClaudeStack.Web.Tests/
โโโ ClaudeStack.Web.Tests.Playwright/
โโโ ClaudeStack.API.Tests/
โโโ ClaudeStack.API.Tests.Playwright/
global.json: Pins .NET SDK to 10.0.100-rc.2.25502.107 Directory.Build.props: Sets TargetFramework, ImplicitUsings (disabled), Nullable (disabled) Directory.Packages.props: Centralizes all NuGet package versions (see dotnet-centralized-packages skill)
# From solution root
dotnet build
# With configuration
dotnet build --configuration Release
# Verbose output
dotnet build --verbosity detailed
dotnet build src/ClaudeStack.Web/ClaudeStack.Web.csproj
dotnet build src/ClaudeStack.API/ClaudeStack.API.csproj
# Clean build artifacts
dotnet clean
# Clean then build
dotnet clean && dotnet build
# Clean specific configuration
dotnet clean --configuration Release
# Restore NuGet packages
dotnet restore
# Force re-download
dotnet restore --force
# Clear cache and restore
dotnet nuget locals all --clear
dotnet restore
# From solution root
dotnet run --project src/ClaudeStack.Web/ClaudeStack.Web.csproj
# Or navigate to project directory
cd src/ClaudeStack.Web
dotnet run
Runs at: https://localhost:7001 (configured in launchSettings.json)
dotnet run --project src/ClaudeStack.API/ClaudeStack.API.csproj
Runs at: https://localhost:5001
# Auto-restart on file changes
dotnet watch --project src/ClaudeStack.Web
# With specific launch profile
dotnet watch --project src/ClaudeStack.Web --launch-profile https
Key feature: Razor runtime compilation enabled in ClaudeStack.Web - changes to .cshtml files reload automatically.
# From solution root
dotnet test
Runs all 4 test projects:
# Using dotnet run (Microsoft.Testing.Platform)
dotnet run --project tests/ClaudeStack.Web.Tests
# Using dotnet test (also works)
dotnet test tests/ClaudeStack.Web.Tests/ClaudeStack.Web.Tests.csproj
See mstest-testing-platform skill for detailed testing guidance.
# Run specific test method
dotnet test --filter FullyQualifiedName~TestMethod1
# Run tests in a class
dotnet test --filter FullyQualifiedName~ClaudeStack.Web.Tests.Test1
# Detailed output
dotnet test --verbosity detailed
# Generate TRX results
dotnet test --logger "trx;LogFileName=results.trx"
This project uses the XML-based solution format (sln.slnx) introduced in .NET:
# List projects in solution
dotnet sln sln.slnx list
# Add project to solution
dotnet sln sln.slnx add src/Example.NewProject/Example.NewProject.csproj
# Remove project
dotnet sln sln.slnx remove src/Example.OldProject/Example.OldProject.csproj
# Create new web project
dotnet new mvc -o src/Example.NewWeb
# Create new API project
dotnet new webapi -o src/Example.NewAPI
# Create new test project (DON'T use --test-runner flag!)
dotnet new mstest -o tests/Example.NewWeb.Tests
IMPORTANT: Never use --test-runner flag - it overwrites global.json. The test runner is already configured globally.
# Add reference from test project to web project
dotnet add tests/ClaudeStack.Web.Tests reference src/ClaudeStack.Web
# List packages in solution
dotnet list package
# Show outdated packages
dotnet list package --outdated
# Include transitive dependencies
dotnet list package --include-transitive
With CPM (this project):
# Step 1: Edit Directory.Packages.props
# <PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
# Step 2: Add reference to project
dotnet add src/ClaudeStack.Web package Newtonsoft.Json
See dotnet-centralized-packages skill for details.
# Build
dotnet build # Build solution
dotnet build --configuration Release # Release build
dotnet clean # Clean artifacts
# Run
dotnet run --project src/ClaudeStack.Web # Run web app
dotnet watch --project src/ClaudeStack.Web # Run with hot reload
# Test
dotnet test # Run all tests
dotnet run --project tests/ClaudeStack.Web.Tests # Run specific test project
# Solution
dotnet sln list # List projects
dotnet sln add path/to/project.csproj # Add project
# Packages
dotnet list package # List packages
dotnet list package --outdated # Check for updates
dotnet restore # Restore dependencies
# Create new project
dotnet new mvc -o src/MyProject
dotnet new webapi -o src/MyAPI
dotnet new mstest -o tests/MyTests
# Add references
dotnet add tests/MyTests reference src/MyProject
dotnet add src/MyProject package PackageName
--configuration Release # Build configuration
--verbosity detailed # Output level
--no-restore # Skip restore
--no-build # Skip build (for tests)
--framework net10.0 # Target framework
# ClaudeStack.Web (MVC)
src/ClaudeStack.Web/ClaudeStack.Web.csproj
https://localhost:7001
# ClaudeStack.API (Minimal APIs)
src/ClaudeStack.API/ClaudeStack.API.csproj
https://localhost:5001
# Test projects
tests/ClaudeStack.Web.Tests
tests/ClaudeStack.API.Tests
tests/ClaudeStack.Web.Tests.Playwright
tests/ClaudeStack.API.Tests.Playwright
This project uses .NET 10 RC 2. Some commands may behave differently in the RTM release.