MSB4057:项目中不存在目标 "Release":在 TeamCity 的 csproj 中

MSB4057: The target "Release" does not exist in the project: in csproj in TeamCity

我已经使用 msbuild(Microsoft BuildTools 2019,ToolsVersion 16.0)设置了构建步骤

如果我将构建目标设置为 Release,我会在标题中看到错误。 如果我将构建目标设置为调试,我会得到等效的错误。

如果我根本不设置构建目标,我会得到: NETSDK1004: Assets file 'C:\TeamCity\buildAgent\work\b8126aa0ba178445\Test\Application\Matisa.Test.ApplicationEnums\obj\project.assets.json' not found

我试过切换到 .NET CLI 生成器,但它给出了同样的错误。

看来您需要以某种方式在管道中 运行 dotnet restore。您可以尝试使用 restore 命令将 .NET CLI 步骤添加到构建定义中,并将其放在 msbuild 步骤之前。

对不起,傻我...

目标不是 DebugRelease,而是 Build/Restore 等等...搞混了。

调试或发布进入参数。