在 ASP.NET 核心项目上删除默认的调试构建配置

Remove Debug build configuration as default on an ASP.NET Core project

在 ASP.NET Core 3.1 应用程序 CSProj 文件中,我有以下内容:

<PropertyGroup Condition="'$(Configuration)' == 'development'">
  <ConfigurationGroup>Debug</ConfigurationGroup>
</PropertyGroup>

所以我设置了一个 'development' 构建配置,它基本上是调试配置。

当我简单地使用 dotnet build 时,项目是使用调试配置构建的。

要使用开发配置,我需要使用 dotnet build -c development

是否可以将 development 配置设置为默认配置以便由以下人员使用:

dotnet 构建

在大多数 csproj 文件中,您会看到变量分配给默认值,如下所示:

<PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
</PropertyGroup>

我想在你的情况下你想要这样的东西:

<PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">development</Configuration>
</PropertyGroup>