Solution build configuration – create – configure – use in C#

  1. Debug and Release are predefined
  2. When in Debug – check if “Define DEBUG constant” is checked
  3. Use Solution -> Configuration Manager to create other configurations
  4. Use Project Properties – Build (Side) Tab – To add/edit Conditional compilation symbols

    Build - Conditional compilation symbols

  5. Use in C#

    #if DEBUG
    jsonFileName = “appsettings.Development.json”;
    #elif STAGING
    jsonFileName = “appsettings.Staging.json”;
    #else
    jsonFileName = “appsettings.json”;
    #endif

  6. Easy to change config on VS top tool bar

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: