I know little about the architecture of appsettings (I never used it), but you can define different values ββfor constants using a bit of MSBuild magic.
Create two .cs files, Constants1.cs and Constants2.cs (or name them after your configurations).
In each file, define the Constants class (or something else) - but do it as if each file was the only definition (i.e. use the same class name). Typically, this should simply define the public static readonly fields - do not use const , as this may cause you problems with partial assemblies.
Now upload the project file and edit it. Find entries that look like this:
<Compile Include = "Constants1.cs" />
<Compile Include = "Constants2.cs" />
and change them like this:
<Compile Include = "Constants1.cs" Condition = "'$ (Configuration)' == 'Debug'" />
<Compile Include = "Constants2.cs" Condition = "'$ (Configuration)' == 'Release'" />
Finally, save and reload the project. Now only one of the files will actually be created at a time, depending on the build configuration.
Miral source share