net-cli
.NET command-line tools for building, testing, and formatting. Common dotnet commandsand development workflow.Keywords: dotnet build, dotnet restore, dotnet test, dotnet format, dotnet run,NuGet, package restore, CLI commands, build system
When & Why to Use This Skill
The .NET CLI skill provides a comprehensive suite of command-line tools for managing the entire lifecycle of .NET applications. It enables Claude to perform essential development tasks such as building solutions, running sophisticated test suites, managing NuGet dependencies, and enforcing code style through automated formatting. By integrating these CLI capabilities, the agent can streamline development workflows, ensure build consistency, and maintain high code quality standards within the .NET ecosystem.
Use Cases
- Automated Build and Testing: Execute full solution builds and run targeted unit or integration tests using advanced filters (by name, class, or category) to validate code changes instantly.
- Dependency and Package Management: Streamline NuGet workflows by adding, removing, or listing packages, and troubleshooting restoration issues by clearing local caches.
- Code Quality and Formatting: Maintain a clean codebase by automatically formatting C# files or verifying formatting compliance as part of a pre-commit or CI process.
- Project Execution and Hot Reload: Run specific projects or complex AppHosts with custom environment variables, utilizing 'dotnet watch' for rapid development with hot reload support.
- Solution Maintenance: Manage multi-project solutions, list project structures, and perform clean rebuilds to resolve environment-specific build artifacts.
| name | .NET CLI |
|---|---|
| description | | |
| Keywords | dotnet build, dotnet restore, dotnet test, dotnet format, dotnet run, |
.NET CLI
Prerequisites
- .NET SDK 10.0
- NuGet feeds defined in
NuGet.Config
Common Commands
Restore Packages
dotnet restore
Build Solution
dotnet build
Run Tests
# All tests
dotnet test
# By test name
dotnet test --filter "FullyQualifiedName~CanCreateOrganization"
# By class name
dotnet test --filter "ClassName~OrganizationTests"
# By category/trait
dotnet test --filter "Category=Integration"
Run Project
# Run the AppHost (recommended for full stack)
dotnet run --project src/Exceptionless.AppHost
# Run specific project
dotnet run --project src/Exceptionless.Web
Format Code
# Format all C# files
dotnet format
# Check without making changes
dotnet format --verify-no-changes
NuGet Configuration
Feeds are defined in NuGet.Config — do not add new sources unless explicitly requested.
Directory.Build.props
Shared settings live in src/Directory.Build.props:
- Target framework versions
- Common package references
- Build properties
Keep changes consistent across the solution.
Build Configurations
# Debug build (default)
dotnet build
# Release build
dotnet build -c Release
# Clean and rebuild
dotnet clean && dotnet build
Watch Mode
# Run with hot reload
dotnet watch run --project src/Exceptionless.Web
Package Management
# Add package to project
dotnet add package Foundatio
# Remove package
dotnet remove package OldPackage
# List packages
dotnet list package
# Check for outdated packages
dotnet list package --outdated
Solution Management
# Build specific project
dotnet build src/Exceptionless.Core
# List projects in solution
dotnet sln list
Environment Variables
# Set environment for run
ASPNETCORE_ENVIRONMENT=Development dotnet run --project src/Exceptionless.Web
Troubleshooting
Clean Restore
# Clear NuGet cache and restore
dotnet nuget locals all --clear
dotnet restore
Verbose Build
dotnet build -v detailed