Miguel Moura
Miguel Moura

Reputation: 39474

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

On an ASP.NET Core 3.1 application CSProj file I have the following:

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

So I set a 'development' build configuration which is basically the debug configuration.

When I simply use dotnet build the project is built with Debug configuration.

To use the development configuration I need to use dotnet build -c development.

Is it possible to set development configuration as default so it is used by:

dotnet build

Upvotes: 0

Views: 427

Answers (1)

C.J.
C.J.

Reputation: 16091

In most csproj files you see assignment of variables to a default value like this:

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

I think in your case you want something like this:

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

Upvotes: 1

Related Questions