发布时将配置设置为 "Release"

Set configuration to "Release" when publishing

我有一个正在使用 dotnet CLI 的 dotnet publish 命令发布的项目。

因为我只发布发布意图,所以我想在发布 dotnet publish 时使用“发布”配置进行构建和发布,但仍然使用“调试” " 当我 debugging/testing.

时在 Visual Studio 内

我知道我可以手动更改 Visual Studio 的 configuration/properties window 的配置并且可以指定 -c Release 参数但是我可以在其中包含一些标签吗我的 .csproj 文件显示“发布时默认使用 'Release'”?

关于此 here 有一个未解决的问题。

你可以检查一下,特别是这个@nguerrera comment

为命令创建 batch/powershell 文件

dotnet publish -c Release

将其保存到 release.cmd 和 运行 中,以便在需要时使用