This is daft

Advertisements

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