Mash.AppSettings.DevSettings 1.2.0

Install-Package Mash.AppSettings.DevSettings -Version 1.2.0
dotnet add package Mash.AppSettings.DevSettings --version 1.2.0
<PackageReference Include="Mash.AppSettings.DevSettings" Version="1.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Mash.AppSettings.DevSettings --version 1.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Mash.AppSettings.DevSettings, 1.2.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Mash.AppSettings.DevSettings as a Cake Addin
#addin nuget:?package=Mash.AppSettings.DevSettings&version=1.2.0

// Install Mash.AppSettings.DevSettings as a Cake Tool
#tool nuget:?package=Mash.AppSettings.DevSettings&version=1.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.


New support in Mash.AppSettings allows for an override setting loader for developer-specific values. Maybe you want a different connection string to an Azure storage account, instrumentation key for Application Insights, or service endpoint. When each developer can specify their own options, you can quickly debug locally without having to keep files checked out with your changes, careful not to accidentally commit them.

Dev setting file

The developer-specific files must be in JSON format, and need only specify app settings you wish to override.

Your code can do a check to see if it is in dev mode (perhaps based on an environment variable). Ideally, each developer in the team can commit their own file to the project using their unique user name to make the files unique that way the call to construct DevSettingLoader will not need to be different per user.

  "Setting1": "DevOverride",
  "ConnectionStrings": {
    "Cxn1": "DevOverrideCxn"

Override settings loading

To override settings loading, simply assign a DevSettingsLoader to AppSettingsLoader. I like to choose to do mine in Debug builds only.

  private static void Main(string[] args)

    // load/access settings

  private static void LoadDevSettings()
      // find the project directory
      var currentDir = Directory.GetCurrentDirectory();
      int binDirIndex = currentDir.LastIndexOf("\\bin");
      var devSettingsDir = currentDir.Remove(binDirIndex);

      // put all developer override files in a subfolder named DevSettings
      devSettingsDir = Path.Combine(devSettingsDir, "DevSettings");

      // fileName null to use the logged in user
      var devSettingLoader = new DevSettingLoader(devSettingsDir, fileName: null);

      // assigning the loader to this property makes the magic work
      AppSettingsLoader.DevSettings = devSettingLoader;

Developer support

Useful information will be traced during loading. Watch your output window for any issues encountered.

What's New

December 6, 2018

Converted project to target .NET Core 2.1.

November 28, 2016

Initial implementation.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.0 306 3/8/2020
1.1.1 690 12/17/2018
1.0.6179.30210 4,709 12/2/2016
1.0.6176.29434 639 11/29/2016

Target net standard. Replace Newtonsoft.Json with System.Text.Json.