用途:指导使用 dotnet CLI 完成 .NET 解决方案/项目的构建,适用于编译 .csproj、.sln 文件、还原 NuGet 包与依赖、按 Debug/Release 配置构建,以及生成二进制、程序集等构建产物。不适用于测试(dotnet-test)、格式化(code-format)或静态分析(code-analyze)。
主要能力:支持整体解决方案构建、仅还原依赖、指定项目构建、Clean 后重建、详细日志构建等。输入包括 target(solution/project/all)、configuration(Debug/Release)、project_path(默认 ./dotnet/PigeonPea.sln);输出为 artifact_path(bin/ 目录)、build_log 与退出码(0 表示成功)。
使用方式:常用命令包括 cd ./dotnet 后执行 dotnet build PigeonPea.sln;Release 构建加 --configuration Release;先还原再构建用 dotnet restore PigeonPea.sln 与 dotnet build PigeonPea.sln --no-restore;Clean 后重建用 dotnet clean 再 dotnet build;指定项目构建用 dotnet build console-app/PigeonPea.Console.csproj;详细日志用 --verbosity detailed。加速可尝试 --no-restore、-m 或 /p:RunAnalyzers=false。
适用场景:克隆后首次构建、测试前构建、生成发布产物、开发环境设置、修复缺失包及 NuGet 排障。
限制与约束:仅在 ./dotnet 目录内操作,不提交 bin/obj/ 目录,追求幂等构建。构建失败需查看错误信息;依赖缺失执行 dotnet restore;NU1301 表示无法访问 NuGet 服务索引;产物过旧先 dotnet clean。成功标志为 Build succeeded 且 0 Warning(s)、0 Error(s),产物位于 ./dotnet/{ProjectName}/bin/{Configuration}/net9.0/。构建前可接 code-format,构建后可接 dotnet-test 与 code-analyze。其余细节暂未提供。