dotnet-build
Build .NET solution/projects using dotnet CLI. Use when task involves compiling, restoring dependencies, or building artifacts.
When & Why to Use This Skill
This Claude skill automates the .NET build process using the dotnet CLI, enabling agents to compile solutions, restore NuGet dependencies, and generate deployment-ready artifacts. It streamlines the development workflow by handling complex build configurations and providing structured feedback for error resolution, making it essential for automated .NET software engineering.
Use Cases
- Automated Compilation: Efficiently compile .NET solutions (.sln) or individual projects (.csproj) to verify code changes and ensure structural integrity.
- Dependency Restoration: Automatically resolve and restore missing NuGet packages to fix environment setup issues or broken references.
- Release Management: Generate optimized production-ready binaries and assemblies by switching between Debug and Release configurations.
- Continuous Integration Support: Facilitate the 'Build' phase of a local CI/CD pipeline, providing clear success indicators and artifact paths for subsequent testing or deployment.
| name | dotnet-build |
|---|---|
| version | 0.2.0 |
| kind | cli |
| description | Build .NET solution/projects using dotnet CLI. Use when task involves compiling, restoring dependencies, or building artifacts. |
| target | [solution, project, all] |
| configuration | [Debug, Release] |
| project_path | string |
| success | 'Build completes with zero errors; artifacts in bin/' |
| failure | 'Non-zero exit code or compilation errors' |
.NET Build Skill (Entry Map)
Goal: Guide agent to the exact build procedure needed.
Quick Start (Pick One)
- Build entire solution →
references/build-solution.md - Restore dependencies only →
references/restore-deps.md
When to Use
- Compile .NET code (
.csproj,.slnfiles) - Restore NuGet packages and dependencies
- Build Debug/Release configurations
- Generate build artifacts (binaries, assemblies)
NOT for: tests (dotnet-test), formatting (code-format), or analysis (code-analyze)
Inputs & Outputs
Inputs: target (solution/project/all), configuration (Debug/Release), project_path (default: ./dotnet/PigeonPea.sln)
Outputs: artifact_path (bin/ directory), build_log, exit code (0=success)
Guardrails: Operate in ./dotnet only, never commit bin/obj/, idempotent builds
Navigation
1. Build Entire Solution → references/build-solution.md
- First build after cloning, building before tests, creating release artifacts
2. Restore Dependencies Only → references/restore-deps.md
- Setup dev environment, fix missing packages, troubleshoot NuGet
Common Patterns
Quick Build (Debug)
cd ./dotnet
dotnet build PigeonPea.sln
Quick Build (Release)
cd ./dotnet
dotnet build PigeonPea.sln --configuration Release
Restore then Build
cd ./dotnet
dotnet restore PigeonPea.sln
dotnet build PigeonPea.sln --no-restore
Clean and Rebuild
cd ./dotnet
dotnet clean PigeonPea.sln
dotnet build PigeonPea.sln
Build Specific Project
cd ./dotnet
dotnet build console-app/PigeonPea.Console.csproj
Verbose Build for Debugging
cd ./dotnet
dotnet build PigeonPea.sln --verbosity detailed
Troubleshooting
Build fails: Check error messages. See references/build-solution.md for detailed error handling.
Missing dependencies: Run dotnet restore. See references/restore-deps.md.
NU1301 (service index): NuGet unreachable. Check references/restore-deps.md.
Slow builds: Use --no-restore, -m (parallel), or /p:RunAnalyzers=false. See references/build-solution.md.
Stale artifacts: Run dotnet clean then rebuild.
Success Indicators
Build succeeded.
0 Warning(s)
0 Error(s)
Artifacts in: ./dotnet/{ProjectName}/bin/{Configuration}/net9.0/
Integration
After build: dotnet-test (tests), code-analyze (static analysis) Before build: code-format (style fixes)
Related
./dotnet/README.md- Project structure./dotnet/ARCHITECTURE.md- Architecture.pre-commit-config.yaml- Pre-commit hooks