AgentSkillsCN

Build Project

采用高吞吐量的 Git 工作流,使用功能分支,先进行压缩再变基至主干,最后以快进合并完成。历史记录线性,无需 PR 或审查。

SKILL.md
--- frontmatter
name: Build Project
description: Build .NET solutions and projects with structured error parsing. Validates code compiles before proceeding.
dependencies: dotnet

Overview

This skill provides standardized build execution and error parsing for .NET projects. Use it to verify code compiles and identify build errors.

When to Use

  • After making code changes
  • Before running tests
  • Before committing changes
  • Diagnosing compilation errors

Commands

Build Entire Solution

bash
dotnet build

Build Specific Project

bash
dotnet build <path/to/Project.csproj>

Build with Detailed Output

bash
dotnet build --verbosity detailed

Clean Build

When incremental build has issues:

bash
dotnet clean
dotnet build

Release Build

bash
dotnet build --configuration Release

Output Parsing

Success Pattern

code
Build succeeded.
    0 Warning(s)
    0 Error(s)

Error Pattern

code
error CS1002: ; expected
   path/to/File.cs(42,15): error CS1002: ; expected

Error format: <file>(<line>,<column>): error <code>: <message>

Warning Pattern

code
warning CS0168: The variable 'x' is declared but never used
   path/to/File.cs(35,12): warning CS0168: ...

Structured Result Format

After building, report results in this format:

Success

code
## Build Result: ✅ Success

- **Configuration:** Debug
- **Warnings:** <N>
- **Errors:** 0

### Warnings (if any)
| File | Line | Warning |
|------|------|---------|
| `<file>` | <line> | <message> |

Failure

code
## Build Result: ❌ Failed

- **Configuration:** Debug
- **Warnings:** <N>
- **Errors:** <N>

### Errors
| File | Line | Error |
|------|------|-------|
| `<file>` | <line> | `<code>`: <message> |

### Fix Suggestions
- <Error 1>: <Suggested fix>
- <Error 2>: <Suggested fix>

Common Error Codes

CodeMeaningCommon Fix
CS0103Name does not existMissing using statement or typo
CS0246Type not foundMissing reference or using statement
CS1002; expectedMissing semicolon
CS1061Member not foundMethod doesn't exist on type
CS0029Cannot convert typeType mismatch, need cast or fix
CS0117Type does not contain definitionWrong method name or missing method
CS0535Interface not implementedAdd missing interface members

Restore Dependencies

If build fails due to missing packages:

bash
dotnet restore
dotnet build

Rules

  • Always build before running tests
  • Fix all errors before proceeding (warnings can be deferred)
  • Report exact error locations for quick fixes
  • Use clean build if incremental build behaves unexpectedly