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”;
    jsonFileName = “appsettings.json”;

  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: Logo

You are commenting using your 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: