Skip to content

Commit 1bd1157

Browse files
author
mwatson
committed
Fix bug with .NET 4.5.1+ at .net core with settings
1 parent 5f5fb3e commit 1bd1157

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Src/StackifyLib/Config.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,16 +126,17 @@ internal static string Get(string key, string defaultValue = null)
126126
{
127127

128128

129-
#if NETSTANDARD1_3
129+
#if NETSTANDARD1_3 || NET451
130130
if (_Configuration != null)
131131
{
132132
var appSettings = _Configuration.GetSection("Stackify");
133133
v = appSettings[key.Replace("Stackify.", "")];
134134
}
135135
#endif
136136

137-
#if NET451 || NET45 || NET40s
138-
v = System.Configuration.ConfigurationManager.AppSettings[key];
137+
#if NET451 || NET45 || NET40
138+
if (string.IsNullOrEmpty(v))
139+
v = System.Configuration.ConfigurationManager.AppSettings[key];
139140
#endif
140141

141142
if (string.IsNullOrEmpty(v))

0 commit comments

Comments
 (0)