diff --git a/samples/SampleWebApp/Web.config b/samples/SampleWebApp/Web.config index 9ee9f48..d58e445 100644 --- a/samples/SampleWebApp/Web.config +++ b/samples/SampleWebApp/Web.config @@ -14,7 +14,7 @@ - + @@ -32,6 +32,10 @@ + + + + diff --git a/src/KeyPerFile/KeyPerFileConfigBuilder.cs b/src/KeyPerFile/KeyPerFileConfigBuilder.cs index 68a75b1..ac3d77d 100644 --- a/src/KeyPerFile/KeyPerFileConfigBuilder.cs +++ b/src/KeyPerFile/KeyPerFileConfigBuilder.cs @@ -88,10 +88,19 @@ public override ICollection> GetAllValues(string pr /// The value corresponding to the given 'key' or null if no value is found. public override string GetValue(string key) { - if (_allValues != null && _allValues.TryGetValue(key, out string val)) - return val; + string filename = key; + if (!String.IsNullOrEmpty(KeyDelimiter)) + filename = filename.Replace(KeyDelimiter, Path.DirectorySeparatorChar.ToString()); - return null; + if (!String.IsNullOrWhiteSpace(IgnorePrefix)) + { + foreach (var pathPart in filename.Split(new char[] { Path.DirectorySeparatorChar })) { + if (pathPart.StartsWith(IgnorePrefix, StringComparison.OrdinalIgnoreCase)) + return null; + } + } + + return ReadValueFromFile(Path.Combine(DirectoryPath, filename)); } private IDictionary ReadAllValues(string root, string prefix, IDictionary values) @@ -107,7 +116,7 @@ private IDictionary ReadAllValues(string root, string prefix, ID { foreach (var sub in di.EnumerateDirectories()) { - if (!String.IsNullOrWhiteSpace(IgnorePrefix) && sub.Name.StartsWith(IgnorePrefix)) + if (!String.IsNullOrWhiteSpace(IgnorePrefix) && sub.Name.StartsWith(IgnorePrefix, StringComparison.OrdinalIgnoreCase)) continue; ReadAllValues(sub.FullName, sub.Name + KeyDelimiter, values); @@ -116,7 +125,7 @@ private IDictionary ReadAllValues(string root, string prefix, ID foreach (var file in di.EnumerateFiles()) { - if (!String.IsNullOrWhiteSpace(IgnorePrefix) && file.Name.StartsWith(IgnorePrefix)) + if (!String.IsNullOrWhiteSpace(IgnorePrefix) && file.Name.StartsWith(IgnorePrefix, StringComparison.OrdinalIgnoreCase)) continue; string key = prefix + file.Name; diff --git a/src/packages/ConfigurationBuilders.Azure.nupkg/Microsoft.Configuration.ConfigurationBuilders.Azure.nuproj b/src/packages/ConfigurationBuilders.Azure.nupkg/Microsoft.Configuration.ConfigurationBuilders.Azure.nuproj index c270c05..a47d673 100644 --- a/src/packages/ConfigurationBuilders.Azure.nupkg/Microsoft.Configuration.ConfigurationBuilders.Azure.nuproj +++ b/src/packages/ConfigurationBuilders.Azure.nupkg/Microsoft.Configuration.ConfigurationBuilders.Azure.nuproj @@ -40,6 +40,9 @@ tools\Net471\ + + README.txt + \ No newline at end of file diff --git a/src/packages/ConfigurationBuilders.Azure.nupkg/README.txt b/src/packages/ConfigurationBuilders.Azure.nupkg/README.txt new file mode 100644 index 0000000..ee71d33 --- /dev/null +++ b/src/packages/ConfigurationBuilders.Azure.nupkg/README.txt @@ -0,0 +1,24 @@ +######################################################################################################################## +## ## +## Microsoft.Configuration.ConfigurationBuilders.Azure ## +## ## +######################################################################################################################## + +WARNING: Double check config builder attributes in your configuraiton files. Some attributes may have been changed + when upgrading this package. + +If this is the first time you are installing this configuration builder into your +project, feel free to click the 'X' on this tab to close and continue on. + +However, if you are updating this package from a version earlier than 1.0.2... you may want to double check the +declarations for your config builders, because we might have lost changes you made to the default declarations +that were created during the original install. + +The upgrade mechanism for nuget is actually just Uninstall/Install, and prior to 1.0.2, this package would delete +the config builder declaration that it created upon install. Makes sense. But if you made any changes to that +declaration without changing the name of it, we didn't bother to make note of that. So the 'install' phase of +updating will declare the default config builder with the default parameters again. (If you did change the name +to something other than the default - AzureKeyVault - then we did not delete your declaration when uninstalling.) + +Starting in version 1.0.2, we have a way to stash old declarations aside and restore them upon install. Sorry for the +inconvenience. There should be no such troubles with future upgrades. diff --git a/src/packages/ConfigurationBuilders.Environment.nupkg/Microsoft.Configuration.ConfigurationBuilders.Environment.nuproj b/src/packages/ConfigurationBuilders.Environment.nupkg/Microsoft.Configuration.ConfigurationBuilders.Environment.nuproj index b7449bc..2f63d4a 100644 --- a/src/packages/ConfigurationBuilders.Environment.nupkg/Microsoft.Configuration.ConfigurationBuilders.Environment.nuproj +++ b/src/packages/ConfigurationBuilders.Environment.nupkg/Microsoft.Configuration.ConfigurationBuilders.Environment.nuproj @@ -40,6 +40,9 @@ tools\Net471\ + + README.txt + \ No newline at end of file diff --git a/src/packages/ConfigurationBuilders.Environment.nupkg/README.txt b/src/packages/ConfigurationBuilders.Environment.nupkg/README.txt new file mode 100644 index 0000000..a569858 --- /dev/null +++ b/src/packages/ConfigurationBuilders.Environment.nupkg/README.txt @@ -0,0 +1,24 @@ +######################################################################################################################## +## ## +## Microsoft.Configuration.ConfigurationBuilders.Environment ## +## ## +######################################################################################################################## + +WARNING: Double check config builder attributes in your configuraiton files. Some attributes may have been changed + when upgrading this package. + +If this is the first time you are installing this configuration builder into your +project, feel free to click the 'X' on this tab to close and continue on. + +However, if you are updating this package from a version earlier than 1.0.2... you may want to double check the +declarations for your config builders, because we might have lost changes you made to the default declarations +that were created during the original install. + +The upgrade mechanism for nuget is actually just Uninstall/Install, and prior to 1.0.2, this package would delete +the config builder declaration that it created upon install. Makes sense. But if you made any changes to that +declaration without changing the name of it, we didn't bother to make note of that. So the 'install' phase of +updating will declare the default config builder with the default parameters again. (If you did change the name +to something other than the default - Environment - then we did not delete your declaration when uninstalling.) + +Starting in version 1.0.2, we have a way to stash old declarations aside and restore them upon install. Sorry for the +inconvenience. There should be no such troubles with future upgrades. diff --git a/src/packages/ConfigurationBuilders.Json.nupkg/Microsoft.Configuration.ConfigurationBuilders.Json.nuproj b/src/packages/ConfigurationBuilders.Json.nupkg/Microsoft.Configuration.ConfigurationBuilders.Json.nuproj index 80a0ec0..00be497 100644 --- a/src/packages/ConfigurationBuilders.Json.nupkg/Microsoft.Configuration.ConfigurationBuilders.Json.nuproj +++ b/src/packages/ConfigurationBuilders.Json.nupkg/Microsoft.Configuration.ConfigurationBuilders.Json.nuproj @@ -40,6 +40,9 @@ tools\Net471\ + + README.txt + \ No newline at end of file diff --git a/src/packages/ConfigurationBuilders.Json.nupkg/README.txt b/src/packages/ConfigurationBuilders.Json.nupkg/README.txt new file mode 100644 index 0000000..5e064bc --- /dev/null +++ b/src/packages/ConfigurationBuilders.Json.nupkg/README.txt @@ -0,0 +1,24 @@ +######################################################################################################################## +## ## +## Microsoft.Configuration.ConfigurationBuilders.Json ## +## ## +######################################################################################################################## + +WARNING: Double check config builder attributes in your configuraiton files. Some attributes may have been changed + when upgrading this package. + +If this is the first time you are installing this configuration builder into your +project, feel free to click the 'X' on this tab to close and continue on. + +However, if you are updating this package from a version earlier than 1.0.2... you may want to double check the +declarations for your config builders, because we might have lost changes you made to the default declarations +that were created during the original install. + +The upgrade mechanism for nuget is actually just Uninstall/Install, and prior to 1.0.2, this package would delete +the config builder declaration that it created upon install. Makes sense. But if you made any changes to that +declaration without changing the name of it, we didn't bother to make note of that. So the 'install' phase of +updating will declare the default config builder with the default parameters again. (If you did change the name +to something other than the default - SimpleJson - then we did not delete your declaration when uninstalling.) + +Starting in version 1.0.2, we have a way to stash old declarations aside and restore them upon install. Sorry for the +inconvenience. There should be no such troubles with future upgrades. diff --git a/src/packages/ConfigurationBuilders.UserSecrets.nupkg/Microsoft.Configuration.ConfigurationBuilders.UserSecrets.nuproj b/src/packages/ConfigurationBuilders.UserSecrets.nupkg/Microsoft.Configuration.ConfigurationBuilders.UserSecrets.nuproj index 9442d48..61bde06 100644 --- a/src/packages/ConfigurationBuilders.UserSecrets.nupkg/Microsoft.Configuration.ConfigurationBuilders.UserSecrets.nuproj +++ b/src/packages/ConfigurationBuilders.UserSecrets.nupkg/Microsoft.Configuration.ConfigurationBuilders.UserSecrets.nuproj @@ -40,6 +40,9 @@ tools\Net471\ + + README.txt + \ No newline at end of file diff --git a/src/packages/ConfigurationBuilders.UserSecrets.nupkg/README.txt b/src/packages/ConfigurationBuilders.UserSecrets.nupkg/README.txt new file mode 100644 index 0000000..be8572d --- /dev/null +++ b/src/packages/ConfigurationBuilders.UserSecrets.nupkg/README.txt @@ -0,0 +1,41 @@ +######################################################################################################################## +## ## +## Microsoft.Configuration.ConfigurationBuilders.UserSecrets ## +## ## +######################################################################################################################## + +WARNING: Double check config builder attributes in your configuraiton files. Some attributes may have been changed + when upgrading this package. + +If this is the first time you are installing this configuration builder into your +project, feel free to click the 'X' on this tab to close and continue on. + +However, if you are updating this package from a version earlier than 1.0.2... you may want to double check the +declarations for your config builders, because we might have lost changes you made to the default declarations +that were created during the original install. + +The upgrade mechanism for nuget is actually just Uninstall/Install, and prior to 1.0.2, this package would delete +the config builder declaration that it created upon install. Makes sense. But if you made any changes to that +declaration without changing the name of it, we didn't bother to make note of that. So the 'install' phase of +updating will declare the default config builder with the default parameters again. (If you did change the name +to something other than the default - Secrets - then we did not delete your declaration when uninstalling.) + +Starting in version 1.0.2, we have a way to stash old declarations aside and restore them upon install. Sorry for the +inconvenience. There should be no such troubles with future upgrades. + + +######################################################################################################################## + + +In addition to the upgrade trouble mentioned above, we have also made changes to the UserSecrets package specifically. +We no longer create an empty secrets file, nor do we add a link under 'Properties' to the empty secrets file that we +no longer create. And we do not install any .targets/.props files to magically read $(UserSecretsId) from project +settings at compile-time. + +Why? Because Visual Studio will handle these things for you. Similar to the ASP.Net Core User Secrets experience, VS +will have a contextual "Manage User Secrets..." option for your Web Forms projects. Using that will install this +package, create the empty secrets file, and open it for editing. So you will use that menu item instead of seeing +a project item for secrets. + +Also, the first and final word on UserSecretsId is what is set in the builder declaration. No more cumbersome +attempts at using project properties in configuration at runtime. Now, what you see (in *.config) is what you get. :) diff --git a/src/packages/packages.csproj b/src/packages/packages.csproj index e53da29..974f29c 100644 --- a/src/packages/packages.csproj +++ b/src/packages/packages.csproj @@ -63,6 +63,12 @@ + + + + + +