How to create a project configuration based on release?

William Liu 511 Reputation points
2022-12-01T08:06:21.563+00:00

There are two default configurations Debug and Release for a dotnet csharp project.

I am trying to add a configuration which can perform some customization (custom propertys, build tasks, and so on).

<Configurations>Debug;Release;MyConfRel</Configurations>  
  

I can build the project with the following to active "MyConfRel" configuration now.

dotnet build -c MyConfRel  

Here are my two questions,

  1. is the created "MyConfRel" based on a Debug configuration?
  2. If Q1 is yes, then how to create a configuration based on Release configuration?
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,093 questions
Not Monitored
Not Monitored
Tag not monitored by Microsoft.
40,159 questions
{count} votes

Accepted answer
  1. Viorel 118.4K Reputation points
    2022-12-02T12:04:48.597+00:00

    To make a new configuration that is similar to Release, I think that you should also add these lines:

    <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MyConfRel|AnyCPU'">  
        <Optimize>True</Optimize>  
    </PropertyGroup>  
    

    Actually, you can use the Visual, Studio, go to Project Properties and see the differences between configurations, but you should select the "Vary value by Configurations" option that appears for 266617-image.png menues.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.