Update nuget.exe to modernize package structure. (#215)

This commit is contained in:
Steve Molloy 2023-01-17 12:46:06 -08:00 коммит произвёл GitHub
Родитель 0d3af82743
Коммит c438383248
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
27 изменённых файлов: 299 добавлений и 60 удалений

Двоичные данные
.nuget/NuGet.exe

Двоичный файл не отображается.

Просмотреть файл

@ -102,6 +102,17 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{905D083F-6
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SamplesLib", "samples\SamplesLib\SamplesLib.csproj", "{BAA5EB76-5A85-48D6-9E8F-A01A309A2879}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "nuget-docs", "nuget-docs", "{1F8C44D6-1DF2-4CB0-9A93-AC6BF61034E5}"
ProjectSection(SolutionItems) = preProject
src\packages\assets\Readme-Azure.md = src\packages\assets\Readme-Azure.md
src\packages\assets\Readme-AzureAppConfig.md = src\packages\assets\Readme-AzureAppConfig.md
src\packages\assets\Readme-Environment.md = src\packages\assets\Readme-Environment.md
src\packages\assets\Readme-Json.md = src\packages\assets\Readme-Json.md
src\packages\assets\Readme-KeyPerFile.md = src\packages\assets\Readme-KeyPerFile.md
src\packages\assets\Readme-UserSecrets.md = src\packages\assets\Readme-UserSecrets.md
src\packages\assets\Readme.md = src\packages\assets\Readme.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -172,6 +183,7 @@ Global
{18D8B490-1CBC-4783-B6D7-D1A88E832224} = {2F759F48-7F89-4811-8F94-380BCCC83C69}
{0DBFA194-1632-40C0-A072-C59A9280412B} = {2F759F48-7F89-4811-8F94-380BCCC83C69}
{BAA5EB76-5A85-48D6-9E8F-A01A309A2879} = {2F759F48-7F89-4811-8F94-380BCCC83C69}
{1F8C44D6-1DF2-4CB0-9A93-AC6BF61034E5} = {905D083F-6414-4DEA-9779-76C8A2518F8D}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6380A53F-A088-4D0B-B415-C8D16222F022}

Просмотреть файл

@ -1,17 +1,10 @@
# Configuration Builders
[ConfigurationBuilder](https://docs.microsoft.com/en-us/dotnet/api/system.configuration.configurationbuilder?view=netframework-4.7.1)s are a feature of the full .Net
Framework that were introduced in .Net 4.7.1. You can read about the concept in [this blog post](http://jeffreyfritz.com/2017/11/modern-configuration-for-asp-net-4-7-1-with-configurationbuilders/).
While the framework for executing configuration injection now exists in .Net as of 4.7.1 with that feature, the framework does not ship with any pre-made builders in box.
The goal of this project is for Microsoft to provide a basic set of Configuration Builders that should make it easy for developers to leverage this feature in their apps. They
are also intended to address some of the basic dynamic/non-local configuration needs of applications as they move into a container and cloud focused environment.
[ConfigurationBuilder](https://docs.microsoft.com/en-us/dotnet/api/system.configuration.configurationbuilder?view=netframework-4.7.1)s are a feature of the full .Net Framework that were introduced in .Net 4.7.1. You can read about the concept in [this blog post](http://jeffreyfritz.com/2017/11/modern-configuration-for-asp-net-4-7-1-with-configurationbuilders/). While the framework for executing configuration injection now exists in .Net as of 4.7.1 with that feature, the framework does not ship with any pre-made builders in box. The goal of this project is for Microsoft to provide a basic set of Configuration Builders that should make it easy for developers to leverage this feature in their apps. They are also intended to address some of the basic dynamic/non-local configuration needs of applications as they move into a container and cloud focused environment.
The set of builders produced here are styled as "Key/Value Config Builders." The architecture of `ConfigurationBuilder` in the framework is actually quite flexible and can
be leveraged to handle a great number of unique situations. To keep things as easy and as broadly applicable as possible though, this project focuses on simple key/value
scenarios.
The set of builders produced here are styled as "Key/Value Config Builders." The architecture of `ConfigurationBuilder` in the framework is actually quite flexible and can be leveraged to handle a great number of unique situations. To keep things as easy and as broadly applicable as possible though, this project focuses on simple key/value scenarios.
For more information about Configuration Builders and the features and builders in this project in particular, please refer to the docs
linked here:
For more information about Configuration Builders and the features and builders in this project in particular, please refer to the docs linked here:
* [Introduction to Configuration Builders in .Net](docs/Intro.md)
* [Key/Value Config Builders](docs/KeyValueConfigBuilders.md)
@ -23,44 +16,23 @@ linked here:
<a name="updates"></a>
### V3 Updates:
* :warning: ***Breaking Change*** - `Expand` mode is gone. It has been [replaced by `Token` mode](docs/KeyValueConfigBuilders.md#mode).
* `Utils.MapPath` - This was somewhat broken in ASP.Net scenarios previously. It should now reliably go against `Server.MapPath()` in ASP.Net scenarios. It has
also been updated to fall back against the directory of the config file being processed when resolving the app root in the case of a `Configuration`
object being created by `ConfigurationManager.OpenConfiguration*` API's rather than being part of a fully-initialized runtime configuration stack.
* `Utils.MapPath` - This was somewhat broken in ASP.Net scenarios previously. It should now reliably go against `Server.MapPath()` in ASP.Net scenarios. It has also been updated to fall back against the directory of the config file being processed when resolving the app root in the case of a `Configuration` object being created by `ConfigurationManager.OpenConfiguration*` API's rather than being part of a fully-initialized runtime configuration stack.
* Json use has migrated to use `System.Text.Json` instead of `Newtonsoft.Json`.
* The [Azure Config Builders](#azure-config-builders) have been updated to require a newer minimum version of `Azure.Identity` by default which allows for more
methods of connecting to Azure, such as **User-Assigned Managed Identity**, or **Client Certificate-based** via environment variables. Also a pair of overloads
(`GetCredential` and `GetSecretClientOptions/GetConfigurationClientOptions`) have been added for users who need something more than `DefaultAzureCredential`
with default client options can provide.
* Added *RecursionGuard* to help detect and prevent situations where a `ConfigurationBuilder` accessing values from a `ConfigurationSection` other than the one
which it is currently processing could result in stack overflow.
* `optional` attribute is obsolete => [`enabled`](docs/KeyValueConfigBuilders.md#enabled) attribute which provides more versatility. (The `optional` attribute is still parsed and recognized in the absence
of the newer [`enabled`](docs/KeyValueConfigBuilders.md#enabled) attribute, but builders should migrate to use the new attribute name when possible. Installation scripts should try to handle this
automatically.)
* Character Mapping - Some config builders have had an internal mapping of characters that might exist in keys in the config file but are illegal in keys at the
source. As more scenarios come to light and individual prefrences are not always unanimous, V3 instead adds the [`charMap`](docs/KeyValueConfigBuilders.md#charmap) attribute to allow this character
mapping to work with all **KeyValueConfigBuilders** and to be handled in an easily configurable manner.
* `ConnectionStringsSectionHandler2` - A new section handler for the `<connectionStrings>` section has been included in the base package. This new handler will
allow updating of both the 'connectionString' attribute as well as the 'providerName' attribute. It does require the builders and source of config data to be
aware of this new ability though. The default section handler for the `<connectionStrings>` section has not been updated and remains as it was in previous
versions, so apps wishing to take advantage of the new handler will have to wire it up in their config. More details can be found in the
[SectionHandlers documentation](docs/SetionHandlers.md#ConnectionStringsSectionHandler2).
* The [Azure Config Builders](docs/KeyValueConfigBuilders.md#azure-config-builders) have been updated to require a newer minimum version of `Azure.Identity` by default which allows for more methods of connecting to Azure, such as **User-Assigned Managed Identity**, or **Client Certificate-based** via environment variables. Also a pair of overloads (`GetCredential` and `GetSecretClientOptions/GetConfigurationClientOptions`) have been added for users who need something more than `DefaultAzureCredential` with default client options can provide.
* Added *RecursionGuard* to help detect and prevent situations where a `ConfigurationBuilder` accessing values from a `ConfigurationSection` other than the one which it is currently processing could result in stack overflow.
* `optional` attribute is obsolete => [`enabled`](docs/KeyValueConfigBuilders.md#enabled) attribute which provides more versatility. (The `optional` attribute is still parsed and recognized in the absence of the newer [`enabled`](docs/KeyValueConfigBuilders.md#enabled) attribute, but builders should migrate to use the new attribute name when possible. Installation scripts should try to handle this automatically.)
* Character Mapping - Some config builders have had an internal mapping of characters that might exist in keys in the config file but are illegal in keys at the source. As more scenarios come to light and individual prefrences are not always unanimous, V3 instead adds the [`charMap`](docs/KeyValueConfigBuilders.md#charmap) attribute to allow this character mapping to work with all **KeyValueConfigBuilders** and to be handled in an easily configurable manner.
* `ConnectionStringsSectionHandler2` - A new section handler for the `<connectionStrings>` section has been included in the base package. This new handler will allow updating of both the 'connectionString' attribute as well as the 'providerName' attribute. It does require the builders and source of config data to be aware of this new ability though. The default section handler for the `<connectionStrings>` section has not been updated and remains as it was in previous versions, so apps wishing to take advantage of the new handler will have to wire it up in their config. More details can be found in the [SectionHandlers documentation](docs/SetionHandlers.md#ConnectionStringsSectionHandler2).
* `AzureAppConfiguration` nuget package version is revved to match the rest of this suite of builders, rather than being 1 major version behind. (ie, `AzureAppConfiguration:3.0` now depends on `Base:3.0` rather than `AzureAppConfiguration:1.0` depending on `Base:2.0`)
### V2 Updates:
* Azure App Configuration Support - There is a [new builder](docs/KeyValueConfigBuilders.md#azureappconfigurationbuilder) for drawing values from the new Azure App Configuration service.
* ConfigBuilder Parameters from AppSettings - This has been one of the most asked for features of these config builders. With V2, it is now possible to
read initialization parameters for config builders from `appSettings`. Read more about it [here](docs/KeyValueConfigBuilders.md#appsettings-parameters).
* Lazy Initialization - As part of the work to enable pulling config parameters from `appSettings`, these key/value configuration builders now support a
lazy initialization model. Things that must happen immediately can be left in the existing `Initialize(name, config)` method, or builders can leverage
the new `LazyInitialize(name, config)` method for things that can happen just before retrieving values. All builders in this project have been updated to
be lazy whenever possible.
* Updateable Keys - Builders can now massage key names before inserting into config. The [AzureKeyVaultConfigBuilder](docs/KeyValueConfigBuilders.md#azurekeyvaultconfigbuilder) has been
updated to use this feature to allow embedding 'version' tags in key names instead of applying a single 'version' tag to the builder. (Note: This is
seperate from, and performed *after* prefix stripping.)
* **[[Obsolete]] This has been superceded by the [enabled](docs/KeyValueConfigBuilders.md#enabled) tag.** (~~Base Optional Tag - The `optional` tag that some of the builders in
this project employed in V1 has been moved into the base class and is now available on all key/value config builders.~~)
* Escaping Expanded Values - It is possible to xml-escape inserted values in ~~`Expand`~~`Token`(as of V3) mode now using the new [escapeExpandedValues](#escapeexpandedvalues) attribute.
* Section Handlers - This feature allows users to develop extensions that will apply key/value config to sections other than `appSettings` and `connectionStrings`
if desired. Read more about this feature in the [Section Handlers](docs/SectionHandlers.md) segment below.
* ConfigBuilder Parameters from AppSettings - This has been one of the most asked for features of these config builders. With V2, it is now possible to read initialization parameters for config builders from `appSettings`. Read more about it [here](docs/KeyValueConfigBuilders.md#appsettings-parameters).
* Lazy Initialization - As part of the work to enable pulling config parameters from `appSettings`, these key/value configuration builders now support a lazy initialization model. Things that must happen immediately can be left in the existing `Initialize(name, config)` method, or builders can leverage the new `LazyInitialize(name, config)` method for things that can happen just before retrieving values. All builders in this project have been updated to be lazy whenever possible.
* Updateable Keys - Builders can now massage key names before inserting into config. The [AzureKeyVaultConfigBuilder](docs/KeyValueConfigBuilders.md#azurekeyvaultconfigbuilder) has been updated to use this feature to allow embedding 'version' tags in key names instead of applying a single 'version' tag to the builder. (Note: This is seperate from, and performed *after* prefix stripping.)
* **[[Obsolete]] This has been superceded by the [enabled](docs/KeyValueConfigBuilders.md#enabled) tag.** (~~Base Optional Tag - The `optional` tag that some of the builders in this project employed in V1 has been moved into the base class and is now available on all key/value config builders.~~)
* Escaping Expanded Values - It is possible to xml-escape inserted values in ~~`Expand`~~`Token`(as of V3) mode now using the new [escapeExpandedValues](docs/KeyValueConfigBuilders.md#escapeexpandedvalues) attribute.
* Section Handlers - This feature allows users to develop extensions that will apply key/value config to sections other than `appSettings` and `connectionStrings` if desired. Read more about this feature in the [Section Handlers](docs/SectionHandlers.md) segment below.
## How to contribute

Просмотреть файл

@ -149,7 +149,7 @@ actual secret file will be xml formatted - though this should be considered an i
(If you need to share a secrets.json file with Core projects, you could consider using the `SimpleJsonConfigBuilder` below... but as with this
builder, the json format for Core secrets is technically an implementation detail subject to change as well.)
There are three additional configuration attributes for this config builder:
There are two additional configuration attributes for this config builder:
* `userSecretsId` - This is the preferred method for identifying an xml secrets file. It works similar to .Net Core, which uses a 'UserSecretsId' project
property to store this identifier. (The string does not have to be a Guid. Just unique. The VS "Manage User Secrets" experience produces a Guid.) With this
attribute, the `UserSecretsConfigBuilder` will look in a well-known local location (%APPDATA%\Microsoft\UserSecrets\\&lt;userSecretsId&gt;\secrets.xml in
@ -199,7 +199,7 @@ features.
```xml
<add name="AzureAppConfig"
[@mode|@enabled="enabled"|@charMap|@prefix|@stripPrefix|tokenPattern|@escapeExpandedValues]
(@endpoint="https://your-appconfig-store.azconfig.io" | @connectionString="Endpoint=https://your-appconfig-store.azconfig.io;Id=XXXXXXXXXX;Secret=XXXXXXXXXX")
(@endpoint="https://your-appconfig-store.azconfig.io" | <del>@connectionString="Endpoint=https://your-appconfig-store.azconfig.io;Id=XXXXXXXXXX;Secret=XXXXXXXXXX"</del>)
[@keyFilter="string"]
[@labelFilter="label"]
[@acceptDateTime="DateTimeOffset"]
@ -214,8 +214,9 @@ features.
wish to use this new service for managing your configuration, then use this AzureAppConfigurationBuilder. Either `endpoint` or `connectionString` are
required, but all other attributes are optional. If both `endpoint` and `connectionString` are used, then preference is given to the connection string.
* `endpoint` - This specifies the AppConfiguration store to connect to.
* `connectionString` - This specifies the AppConfiguration store to connect to, along with the Id and Secret necessary to access the service. Be careful
not to expose any secrets in your code, repos, or App Configuration stores if you use this method for connecting.
* ~~`connectionString`~~ - The recommendation is to use `endpoint` in conjunction with [DefaultAzureCredential](#azure-config-builders). ~~This specifies
the AppConfiguration store to connect to, along with the Id and Secret necessary to access the service. Be careful
not to expose any secrets in your code, repos, or App Configuration stores if you use this method for connecting.~~
* `keyFilter` - Use this to select a set of configuration values matching a certain key pattern.
* `labelFilter` - Only retrieve configuration values that match a certain label.
* `acceptDateTime` - Instead of versioning ala Azure Key Vault, AppConfiguration uses timestamps. Use this attribute to go back in time
@ -234,7 +235,7 @@ required, but all other attributes are optional. If both `endpoint` and `connect
[@preloadSecretNames="true"]
type="Microsoft.Configuration.ConfigurationBuilders.AzureKeyVaultConfigBuilder, Microsoft.Configuration.ConfigurationBuilders.Azure" />
```
If your secrets are kept in Azure Key Vault, then this config builder is for you. There are three additional attributes for this config builder. The `vaultName`
If your secrets are kept in Azure Key Vault, then this config builder is for you. There are four additional attributes for this config builder. The `vaultName`
attribute (or `uri`) is required. Previous iterations of this config builder allowed for a `connectionString` as a way to supply credential information for connecting to
Azure Key Vault. This method is no longer allowed as it is not a supported scenario for the current `Azure.Identity` SDK which is used for connecting
to Azure services. Instead, this iteration of the config builder exclusively uses [DefaultAzureCredential](https://docs.microsoft.com/en-us/dotnet/api/azure.identity.defaultazurecredential)
@ -296,7 +297,7 @@ begins with 'Simple.' Think of the backing json file as a basic dictionary, rath
(A multi-level heirarchical file can be used. This provider will simply 'flatten' the depth by appending the property name at each level using ':' as a delimiter.)
There are three additional attributes that can be used to configure this builder:
There are two additional attributes that can be used to configure this builder:
* `jsonFile` - A required attribute specifying the json file to draw from. The '~' character can be used at the start to reference the app root.
* `jsonMode` - `[Flat|Sectional]`. 'Flat' is the default.
- This attribute requires a little more explanation. It says above to think of the json file as a single flat key/value source. This is the usual that applies to

Просмотреть файл

@ -40,6 +40,12 @@
<NuGetContent Include="..\ConfigurationBuilders.Base.nupkg\shared\tools\Net471\pp\*.ps1">
<Destination>tools\Net471\</Destination>
</NuGetContent>
<NuGetContent Include="$(RepositoryRoot)\src\packages\assets\Readme-Azure.md">
<Destination>docs\Readme.md</Destination>
</NuGetContent>
<NuGetContent Include="$(RepositoryRoot)\src\packages\assets\dotnet-icon.png">
<Destination>images\dotnet-icon.png</Destination>
</NuGetContent>
</ItemGroup>
<Import Project="$(RepositoryRoot)Tools\NuGetProj.targets"/>
</Project>

Просмотреть файл

@ -11,10 +11,11 @@
<summary>A set of Configuration Builders for the .Net Framework that draw from Azure resources.</summary>
<language>en-US</language>
<projectUrl>https://github.com/aspnet/MicrosoftConfigurationBuilders</projectUrl>
<iconUrl>http://go.microsoft.com/fwlink/?LinkID=288859</iconUrl>
<icon>images\dotnet-icon.png</icon>
<licenseUrl>https://licenses.nuget.org/MIT</licenseUrl>
<license type="expression">MIT</license>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<readme>docs\Readme.md</readme>
<tags>Microsoft Configuration Builders Azure</tags>
<dependencies>

Просмотреть файл

@ -40,6 +40,12 @@
<NuGetContent Include="..\ConfigurationBuilders.Base.nupkg\shared\tools\Net471\pp\*.ps1">
<Destination>tools\Net471\</Destination>
</NuGetContent>
<NuGetContent Include="$(RepositoryRoot)\src\packages\assets\Readme-AzureAppConfig.md">
<Destination>docs\Readme.md</Destination>
</NuGetContent>
<NuGetContent Include="$(RepositoryRoot)\src\packages\assets\dotnet-icon.png">
<Destination>images\dotnet-icon.png</Destination>
</NuGetContent>
</ItemGroup>
<Import Project="$(RepositoryRoot)Tools\NuGetProj.targets"/>
</Project>

Просмотреть файл

@ -11,10 +11,11 @@
<summary>A set of Configuration Builders for the .Net Framework that draw from Azure AppConfiguration stores.</summary>
<language>en-US</language>
<projectUrl>https://github.com/aspnet/MicrosoftConfigurationBuilders</projectUrl>
<iconUrl>http://go.microsoft.com/fwlink/?LinkID=288859</iconUrl>
<icon>images\dotnet-icon.png</icon>
<licenseUrl>https://licenses.nuget.org/MIT</licenseUrl>
<license type="expression">MIT</license>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<readme>docs\Readme.md</readme>
<tags>Microsoft Configuration Builders AzureAppConfiguration</tags>
<dependencies>

Просмотреть файл

@ -34,6 +34,12 @@
<NuGetContent Include="Content\Net471\config.uninstall.xdt">
<Destination>content\Net471\web.config.uninstall.xdt</Destination>
</NuGetContent>
<NuGetContent Include="$(RepositoryRoot)\src\packages\assets\Readme.md">
<Destination>docs\Readme.md</Destination>
</NuGetContent>
<NuGetContent Include="$(RepositoryRoot)\src\packages\assets\dotnet-icon.png">
<Destination>images\dotnet-icon.png</Destination>
</NuGetContent>
</ItemGroup>
<Import Project="$(RepositoryRoot)Tools\NuGetProj.targets"/>
</Project>

Просмотреть файл

@ -11,10 +11,11 @@
<summary>A base framework for basic key/value Configuration Builders for the .Net Framework.</summary>
<language>en-US</language>
<projectUrl>https://github.com/aspnet/MicrosoftConfigurationBuilders</projectUrl>
<iconUrl>http://go.microsoft.com/fwlink/?LinkID=288859</iconUrl>
<icon>images\dotnet-icon.png</icon>
<licenseUrl>https://licenses.nuget.org/MIT</licenseUrl>
<license type="expression">MIT</license>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<readme>docs\Readme.md</readme>
<tags>Microsoft Configuration Builders</tags>
</metadata>
</package>

Просмотреть файл

@ -40,6 +40,12 @@
<NuGetContent Include="..\ConfigurationBuilders.Base.nupkg\shared\tools\Net471\pp\*.ps1">
<Destination>tools\Net471\</Destination>
</NuGetContent>
<NuGetContent Include="$(RepositoryRoot)\src\packages\assets\Readme-Environment.md">
<Destination>docs\Readme.md</Destination>
</NuGetContent>
<NuGetContent Include="$(RepositoryRoot)\src\packages\assets\dotnet-icon.png">
<Destination>images\dotnet-icon.png</Destination>
</NuGetContent>
</ItemGroup>
<Import Project="$(RepositoryRoot)Tools\NuGetProj.targets"/>
</Project>

Просмотреть файл

@ -11,11 +11,12 @@
<summary>A basic key/value Configuration Builder for the .Net Framework that draws from environment variables.</summary>
<language>en-US</language>
<projectUrl>https://github.com/aspnet/MicrosoftConfigurationBuilders</projectUrl>
<iconUrl>http://go.microsoft.com/fwlink/?LinkID=288859</iconUrl>
<icon>images\dotnet-icon.png</icon>
<licenseUrl>https://licenses.nuget.org/MIT</licenseUrl>
<license type="expression">MIT</license>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<tags>Microsoft Configuration Builders - Environment</tags>
<readme>docs\Readme.md</readme>
<tags>Microsoft Configuration Builders Environment</tags>
<dependencies>
<dependency id="Microsoft.Configuration.ConfigurationBuilders.Base" version="$NuGetPackageBaseDependencyVersion$" />

Просмотреть файл

@ -40,6 +40,12 @@
<NuGetContent Include="..\ConfigurationBuilders.Base.nupkg\shared\tools\Net471\pp\*.ps1">
<Destination>tools\Net471\</Destination>
</NuGetContent>
<NuGetContent Include="$(RepositoryRoot)\src\packages\assets\Readme-Json.md">
<Destination>docs\Readme.md</Destination>
</NuGetContent>
<NuGetContent Include="$(RepositoryRoot)\src\packages\assets\dotnet-icon.png">
<Destination>images\dotnet-icon.png</Destination>
</NuGetContent>
</ItemGroup>
<Import Project="$(RepositoryRoot)Tools\NuGetProj.targets"/>
</Project>

Просмотреть файл

@ -11,10 +11,11 @@
<summary>A basic key/value Configuration Builder for the .Net Framework that draws from a json file.</summary>
<language>en-US</language>
<projectUrl>https://github.com/aspnet/MicrosoftConfigurationBuilders</projectUrl>
<iconUrl>http://go.microsoft.com/fwlink/?LinkID=288859</iconUrl>
<icon>images\dotnet-icon.png</icon>
<licenseUrl>https://licenses.nuget.org/MIT</licenseUrl>
<license type="expression">MIT</license>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<readme>docs\Readme.md</readme>
<tags>Microsoft Configuration Builders Json</tags>
<dependencies>

Просмотреть файл

@ -40,6 +40,12 @@
<NuGetContent Include="..\ConfigurationBuilders.Base.nupkg\shared\tools\Net471\pp\*.ps1">
<Destination>tools\Net471\</Destination>
</NuGetContent>
<NuGetContent Include="$(RepositoryRoot)\src\packages\assets\Readme-KeyPerFile.md">
<Destination>docs\Readme.md</Destination>
</NuGetContent>
<NuGetContent Include="$(RepositoryRoot)\src\packages\assets\dotnet-icon.png">
<Destination>images\dotnet-icon.png</Destination>
</NuGetContent>
</ItemGroup>
<Import Project="$(RepositoryRoot)Tools\NuGetProj.targets"/>
</Project>

Просмотреть файл

@ -11,11 +11,12 @@
<summary>A basic key/value Configuration Builder for the .Net Framework that draws single values from plain text files using the filename as the key.</summary>
<language>en-US</language>
<projectUrl>https://github.com/aspnet/MicrosoftConfigurationBuilders</projectUrl>
<iconUrl>http://go.microsoft.com/fwlink/?LinkID=288859</iconUrl>
<icon>images\dotnet-icon.png</icon>
<licenseUrl>https://licenses.nuget.org/MIT</licenseUrl>
<license type="expression">MIT</license>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<tags>Microsoft Configuration Builders - KeyPerFile</tags>
<readme>docs\Readme.md</readme>
<tags>Microsoft Configuration Builders KeyPerFile</tags>
<dependencies>
<dependency id="Microsoft.Configuration.ConfigurationBuilders.Base" version="$NuGetPackageBaseDependencyVersion$" />

Просмотреть файл

@ -40,6 +40,12 @@
<NuGetContent Include="..\ConfigurationBuilders.Base.nupkg\shared\tools\Net471\pp\*.ps1">
<Destination>tools\Net471\</Destination>
</NuGetContent>
<NuGetContent Include="$(RepositoryRoot)\src\packages\assets\Readme-UserSecrets.md">
<Destination>docs\Readme.md</Destination>
</NuGetContent>
<NuGetContent Include="$(RepositoryRoot)\src\packages\assets\dotnet-icon.png">
<Destination>images\dotnet-icon.png</Destination>
</NuGetContent>
</ItemGroup>
<Import Project="$(RepositoryRoot)Tools\NuGetProj.targets"/>
</Project>

Просмотреть файл

@ -11,10 +11,11 @@
<summary>A basic key/value Configuration Builder for the .Net Framework that draws from a a 'secrets' file outside of source control.</summary>
<language>en-US</language>
<projectUrl>https://github.com/aspnet/MicrosoftConfigurationBuilders</projectUrl>
<iconUrl>http://go.microsoft.com/fwlink/?LinkID=288859</iconUrl>
<icon>images\dotnet-icon.png</icon>
<licenseUrl>https://licenses.nuget.org/MIT</licenseUrl>
<license type="expression">MIT</license>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<readme>docs\Readme.md</readme>
<tags>Microsoft Configuration Builders</tags>
<dependencies>

Просмотреть файл

@ -0,0 +1,39 @@
# Azure KeyVault ConfigBuilder
This package provides a config builder that draws its values from an Azure Key Vault. The builder [uses `DefaultAzureCredential`](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#azure-config-builders) for connecting with the Key Vault service. More comprehensive documentation exists at [the MicrosoftConfigBuilders project](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#azurekeyvaultconfigbuilder).
The basic usage of this builder is given below. Parameters inside `[]`s are optional. Parameters grouped in `()`s are mutually exclusive. Parameters beginning with `@` allow appSettings substitution. The first line of parameters are common to all builders and optional. Their meaning, usage, and defaults are [documented here](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#introduction-to-keyvalue-config-builders). They are grouped on one line for brevity. When a builder uses a different default value than the project default, the differing value is also listed. Builder-specific settings are listed on each line thereafter followed by a brief explanation.
```xml
<add name="AzureKeyVault"
[@mode|@enabled="enabled"|@charMap=":=-,_=-,.=-,+=-,\=-"|@prefix|@stripPrefix|tokenPattern|@escapeExpandedValues]
(@vaultName="MyVaultName" | @uri="https://MyVaultName.vault.azure.net")
[@version="secrets version"]
[@preloadSecretNames="true"]
type="Microsoft.Configuration.ConfigurationBuilders.AzureKeyVaultConfigBuilder, Microsoft.Configuration.ConfigurationBuilders.Azure" />
```
* `vaultName` - This (or `uri`) is a required attribute. It specifies the name of the vault in your Azure subscription from which to read key/value pairs.
* `uri` - Connect to non-Azure Key Vault providers with this attribute. If not specified, Azure is the assumed Vault provider. If the uri _is_ specified, then `vaultName` is no longer a required parameter.
* `version` - Azure Key Vault provides a versioning feature for secrets. If this is specified, the builder will only retrieve secrets matching this version.
* `preloadSecretNames` - By default, this builder will query __all__ the key names in the key vault when it is initialized to improve performance. If this is a concern, set this attribute to 'false', and secrets will be retrieved one at a time. This could also be useful if the vault allows "Get" access but not "List" access. (NOTE: Disabling preload is incompatible with Greedy mode.)
__Tip:__ To use versioned secrets, it is _not_ recommended to use the `version` attribute on the builder. Rather, include the version in the key-name and this builder will know what to do. For example:
```xml
<appSettings configBuilders="AzureKeyVault">
<add key="item1" value="Replaced with latest value from the key vault." />
<add key="item2/0123456789abcdefdeadbeefbadf00d" value="Replaced with specific version only, and resulting key is simply 'item2'." />
</appSettings>
```
### V3 Updates:
A more complete list of updates [lives here](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/README.md#v3-updates). These are the ones most relevant to this builder:
* :warning: ***Breaking Change*** - `Expand` mode is gone. It has been [replaced by `Token` mode](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#mode).
* The [Azure Config Builders](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#azure-config-builders) have been updated to require a newer minimum version of `Azure.Identity` by default which allows for more methods of connecting to Azure, such as **User-Assigned Managed Identity**, or **Client Certificate-based** via environment variables. Also a pair of overloads (`GetCredential` and `GetSecretClientOptions/GetConfigurationClientOptions`) have been added for users who need something more than `DefaultAzureCredential` with default client options can provide.
* `optional` attribute is obsolete => [`enabled`](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#enabled) attribute which provides more versatility. (The `optional` attribute is still parsed and recognized in the absence of the newer [`enabled`](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#enabled) attribute, but builders should migrate to use the new attribute name when possible. Installation scripts should try to handle this automatically.)
### V2 Updates:
A more complete list of updates [lives here](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/README.md#v2-updates). These are the ones most relevant to this builder:
* ConfigBuilder Parameters from AppSettings - This has been one of the most asked for features of these config builders. With V2, it is now possible to read initialization parameters for config builders from `appSettings`. Read more about it [here](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#appsettings-parameters).
* Updateable Keys - Builders can now massage key names before inserting into config. The [AzureKeyVaultConfigBuilder](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#azurekeyvaultconfigbuilder) has been updated to use this feature to allow embedding 'version' tags in key names instead of applying a single 'version' tag to the builder. (Note: This is seperate from, and performed *after* prefix stripping.)
* **[[Obsolete]] This has been superceded by the [enabled](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#enabled) tag.** (~~Base Optional Tag - The `optional` tag that some of the builders in this project employed in V1 has been moved into the base class and is now available on all key/value config builders.~~)

Просмотреть файл

@ -0,0 +1,37 @@
# Azure AppConfiguration ConfigBuilder
This package provides a config builder that draws its values from an Azure App Configuration. The builder [uses `DefaultAzureCredential`](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#azure-config-builders) for connecting with the App Configuration service. More comprehensive documentation exists at [the MicrosoftConfigBuilders project](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#azureappconfigurationbuilder).
The basic usage of this builder is given below. Parameters inside `[]`s are optional. Parameters grouped in `()`s are mutually exclusive. Parameters beginning with `@` allow appSettings substitution. The first line of parameters are common to all builders and optional. Their meaning, usage, and defaults are [documented here](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#introduction-to-keyvalue-config-builders). They are grouped on one line for brevity. When a builder uses a different default value than the project default, the differing value is also listed. Builder-specific settings are listed on each line thereafter followed by a brief explanation.
```xml
<add name="AzureAppConfig"
[@mode|@enabled="enabled"|@charMap|@prefix|@stripPrefix|tokenPattern|@escapeExpandedValues]
(@endpoint="https://your-appconfig-store.azconfig.io" | @connectionString="Endpoint=https://your-appconfig-store.azconfig.io;Id=XXXXXXXXXX;Secret=XXXXXXXXXX")
[@keyFilter="string"]
[@labelFilter="label"]
[@acceptDateTime="DateTimeOffset"]
[@useAzureKeyVault="bool"]
type="Microsoft.Configuration.ConfigurationBuilders.AzureAppConfigurationBuilder, Microsoft.Configuration.ConfigurationBuilders.AzureAppConfiguration" />
```
>:information_source: [NOTE]
>
>When connecting to an Azure App Configuration store, the identity that is being used must be assigned either the `Azure App Configuration Data Reader` role or the `Azure App Configuration Data Owner` role. Otherwise the config builder will encounter a "403 Forbidden" response from Azure and throw an exception if not `optional`.
* `endpoint` - This specifies the AppConfiguration store to connect to.
* `connectionString` - The recommendation is to use `endpoint`. ~~This specifies the AppConfiguration store to connect to, along with the Id and Secret necessary to access the service. Be carefulnot to expose any secrets in your code, repos, or App Configuration stores if you use this method for connecting.~~
* `keyFilter` - Use this to select a set of configuration values matching a certain key pattern.
* `labelFilter` - Only retrieve configuration values that match a certain label.
* `acceptDateTime` - Instead of versioning ala Azure Key Vault, AppConfiguration uses timestamps. Use this attribute to go back in time to retrieve configuration values from a past state.
* `useAzureKeyVault` - Enable this feature to allow AzureAppConfigurationBuilder to connect to and retrieve secrets from Azure Key Vault for config values that are stored in Key Vault. The same managed service identity that is used for connecting to the AppConfiguration service will be used to connect to Key Vault. The Key Vault uri is retrieved as part of the data from AppConfiguration and does not need to be specific here. Default is `false`.
### V3 Updates:
A more complete list of updates [lives here](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/README.md#v3-updates). These are the ones most relevant to this builder:
* :warning: ***Breaking Change*** - `Expand` mode is gone. It has been [replaced by `Token` mode](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#mode).
* The [Azure Config Builders](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#azure-config-builders) have been updated to require a newer minimum version of `Azure.Identity` by default which allows for more methods of connecting to Azure, such as **User-Assigned Managed Identity**, or **Client Certificate-based** via environment variables. Also a pair of overloads (`GetCredential` and `GetSecretClientOptions/GetConfigurationClientOptions`) have been added for users who need something more than `DefaultAzureCredential` with default client options can provide.
* `optional` attribute is obsolete => [`enabled`](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#enabled) attribute which provides more versatility. (The `optional` attribute is still parsed and recognized in the absence of the newer [`enabled`](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#enabled) attribute, but builders should migrate to use the new attribute name when possible. Installation scripts should try to handle this automatically.)
* `AzureAppConfiguration` nuget package version is revved to match the rest of this suite of builders, rather than being 1 major version behind. (ie, `AzureAppConfiguration:3.0` now depends on `Base:3.0` rather than `AzureAppConfiguration:1.0` depending on `Base:2.0`)
### V1 Updates:
A more complete list of updates [lives here](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/README.md#v2-updates). These are the ones most relevant to this builder:
* Azure App Configuration Support - There is a [new builder](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#azureappconfigurationbuilder) for drawing values from the new Azure App Configuration service.

Просмотреть файл

@ -0,0 +1,22 @@
# Environment ConfigBuilder
This package offers the most basic of the config builders. It draws its values from Environment, and it does not have any additional configuration options. More comprehensive documentation exists at [the MicrosoftConfigBuilders project](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#environmentconfigbuilder).
The basic usage of this builder is given below. Parameters inside `[]`s are optional. Parameters grouped in `()`s are mutually exclusive. Parameters beginning with `@` allow appSettings substitution. The first line of parameters are common to all builders and optional. Their meaning, usage, and defaults are [documented here](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#introduction-to-keyvalue-config-builders). They are grouped on one line for brevity. When a builder uses a different default value than the project default, the differing value is also listed. Builder-specific settings are listed on each line thereafter followed by a brief explanation.
```xml
<add name="Environment"
[@mode|@enabled="optional"|@charMap=":=__"|@prefix|@stripPrefix|tokenPattern|@escapeExpandedValues]
type="Microsoft.Configuration.ConfigurationBuilders.EnvironmentConfigBuilder, Microsoft.Configuration.ConfigurationBuilders.Environment" />
```
### V3 Updates:
A more complete list of updates [lives here](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/README.md#v3-updates). These are the ones most relevant to this builder:
* :warning: ***Breaking Change*** - `Expand` mode is gone. It has been [replaced by `Token` mode](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#mode).
* `optional` attribute is obsolete => [`enabled`](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#enabled) attribute which provides more versatility. (The `optional` attribute is still parsed and recognized in the absence of the newer [`enabled`](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#enabled) attribute, but builders should migrate to use the new attribute name when possible. Installation scripts should try to handle this automatically.)
* Character Mapping - Some config builders have had an internal mapping of characters that might exist in keys in the config file but are illegal in keys at the source. As more scenarios come to light and individual prefrences are not always unanimous, V3 instead adds the [`charMap`](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#charmap) attribute to allow this character mapping to work with all **KeyValueConfigBuilders** and to be handled in an easily configurable manner.
### V2 Updates:
A more complete list of updates [lives here](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/README.md#v2-updates). These are the ones most relevant to this builder:
* ConfigBuilder Parameters from AppSettings - This has been one of the most asked for features of these config builders. With V2, it is now possible to read initialization parameters for config builders from `appSettings`. Read more about it [here](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#appsettings-parameters).
* **[[Obsolete]] This has been superceded by the [enabled](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#enabled) tag.** (~~Base Optional Tag - The `optional` tag that some of the builders in this project employed in V1 has been moved into the base class and is now available on all key/value config builders.~~)

Просмотреть файл

@ -0,0 +1,24 @@
# SimpleJson ConfigBuilder
This package provides a config builder that draws its values from Json file. It comes without many frills, but does offer the ability to treat the entire Json file as a single flat config source or as a set of config sources broken into flat sections at the first level. More comprehensive documentation exists at [the MicrosoftConfigBuilders project](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#simplejsonconfigbuilder).
The basic usage of this builder is given below. Parameters inside `[]`s are optional. Parameters grouped in `()`s are mutually exclusive. Parameters beginning with `@` allow appSettings substitution. The first line of parameters are common to all builders and optional. Their meaning, usage, and defaults are [documented here](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#introduction-to-keyvalue-config-builders). They are grouped on one line for brevity. When a builder uses a different default value than the project default, the differing value is also listed. Builder-specific settings are listed on each line thereafter followed by a brief explanation.
```xml
<add name="SimpleJson"
[@mode|@enabled="optional"|@charMap|@prefix|@stripPrefix|tokenPattern|@escapeExpandedValues]
@jsonFile="~\config.json"
[@jsonMode="(Flat*|Sectional)"]
type="Microsoft.Configuration.ConfigurationBuilders.SimpleJsonConfigBuilder, Microsoft.Configuration.ConfigurationBuilders.Json" />
```
### V3 Updates:
A more complete list of updates [lives here](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/README.md#v3-updates). These are the ones most relevant to this builder:
* :warning: ***Breaking Change*** - `Expand` mode is gone. It has been [replaced by `Token` mode](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#mode).
* Json use has migrated to use `System.Text.Json` instead of `Newtonsoft.Json`.
* `optional` attribute is obsolete => [`enabled`](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#enabled) attribute which provides more versatility. (The `optional` attribute is still parsed and recognized in the absence of the newer [`enabled`](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#enabled) attribute, but builders should migrate to use the new attribute name when possible. Installation scripts should try to handle this automatically.)
### V2 Updates:
A more complete list of updates [lives here](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/README.md#v2-updates). These are the ones most relevant to this builder:
* ConfigBuilder Parameters from AppSettings - This has been one of the most asked for features of these config builders. With V2, it is now possible to read initialization parameters for config builders from `appSettings`. Read more about it [here](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#appsettings-parameters).
* **[[Obsolete]] This has been superceded by the [enabled](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#enabled) tag.** (~~Base Optional Tag - The `optional` tag that some of the builders in this project employed in V1 has been moved into the base class and is now available on all key/value config builders.~~)

Просмотреть файл

@ -0,0 +1,24 @@
# KeyPerFile ConfigBuilder
This package provides a config builder that draws its values from a directory's files as a source of values. A file's name is the key, and the contents are the value. This config builder can be useful when running in an orchestrated container environment, as systems like Docker Swarm and Kubernetes provide 'secrets' to their orchestrated windows containers in this key-per-file manner. More comprehensive documentation exists at [the MicrosoftConfigBuilders project](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#keyperfileconfigbuilder).
The basic usage of this builder is given below. Parameters inside `[]`s are optional. Parameters grouped in `()`s are mutually exclusive. Parameters beginning with `@` allow appSettings substitution. The first line of parameters are common to all builders and optional. Their meaning, usage, and defaults are [documented here](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#introduction-to-keyvalue-config-builders). They are grouped on one line for brevity. When a builder uses a different default value than the project default, the differing value is also listed. Builder-specific settings are listed on each line thereafter followed by a brief explanation.
```xml
<add name="KeyPerFile"
[@mode|@enabled="enabled"|@charMap|@prefix|@stripPrefix|tokenPattern|@escapeExpandedValues]
@directoryPath="PathToSourceDirectory"
[@ignorePrefix="ignore."]
[keyDelimiter=":"]
type="Microsoft.Configuration.ConfigurationBuilders.KeyPerFileConfigBuilder, Microsoft.Configuration.ConfigurationBuilders.KeyPerFile" />
```
### V3 Updates:
A more complete list of updates [lives here](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/README.md#v3-updates). These are the ones most relevant to this builder:
* :warning: ***Breaking Change*** - `Expand` mode is gone. It has been [replaced by `Token` mode](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#mode).
* `optional` attribute is obsolete => [`enabled`](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#enabled) attribute which provides more versatility. (The `optional` attribute is still parsed and recognized in the absence of the newer [`enabled`](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#enabled) attribute, but builders should migrate to use the new attribute name when possible. Installation scripts should try to handle this automatically.)
### V2 Updates:
A more complete list of updates [lives here](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/README.md#v2-updates). These are the ones most relevant to this builder:
* ConfigBuilder Parameters from AppSettings - This has been one of the most asked for features of these config builders. With V2, it is now possible to read initialization parameters for config builders from `appSettings`. Read more about it [here](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#appsettings-parameters).
* **[[Obsolete]] This has been superceded by the [enabled](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#enabled) tag.** (~~Base Optional Tag - The `optional` tag that some of the builders in this project employed in V1 has been moved into the base class and is now available on all key/value config builders.~~)

Просмотреть файл

@ -0,0 +1,25 @@
# UserSecrets ConfigBuilder
This package provides a config builder that draws its values from an `Xml` file - usually stored outside of source controll - containing a list of secrets. The secrets file can be configured directly, or it can be specified by a `userSecretsId` which helps to locate the file in a well-known 'UserSecrets' directory. More comprehensive documentation for using this builder exists at [the MicrosoftConfigBuilders project](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#usersecretsconfigbuilder).
The basic usage of this builder is given below. Parameters inside `[]`s are optional. Parameters grouped in `()`s are mutually exclusive. Parameters beginning with `@` allow appSettings substitution. The first line of parameters are common to all builders and optional. Their meaning and use are [documented at the MicrosoftConfigBuilders project](blob/main/docs/KeyValueConfigBuilders.md#keyvalue-config-builders). Tthey are grouped on one line for brevity. Builder-specific settings are listed on each line thereafter followed by a brief explanation at the end. When a builder uses a different default value than the [MicrosoftConfigBuilders](https://github.com/aspnet/MicrosoftConfigurationBuilders) project as a whole, the differing default is also listed.
```xml
<add name="UserSecrets"
[@mode|@enabled="optional"|@charMap|@prefix|@stripPrefix|tokenPattern|@escapeExpandedValues]
(@userSecretsId="12345678-90AB-CDEF-1234-567890" | @userSecretsFile="~\secrets.file")
type="Microsoft.Configuration.ConfigurationBuilders.UserSecretsConfigBuilder, Microsoft.Configuration.ConfigurationBuilders.UserSecrets" />
```
* `userSecretsId` - This is the preferred method for identifying an xml secrets file. It works similar to .Net Core, which uses a 'UserSecretsId' project property to store this identifier. With this attribute, the `UserSecretsConfigBuilder` will look in a well-known local location (%APPDATA%\Microsoft\UserSecrets\\&lt;userSecretsId&gt;\secrets.xml in Windows environments) for a secrets file belonging to this identifier.
* `userSecretsFile` - An optional attribute specifying the file containing the secrets. The '~' character can be used at the start to reference the app root. One of this attribute or the 'userSecretsId' attribute is required. If both are specified, 'userSecretsFile' takes precedence.
### V3 Updates:
A more complete list of updates [lives here](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/README.md#v3-updates). These are the ones most relevant to this builder:
* :warning: ***Breaking Change*** - `Expand` mode is gone. It has been [replaced by `Token` mode](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#mode).
* `optional` attribute is obsolete => [`enabled`](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#enabled) attribute which provides more versatility. (The `optional` attribute is still parsed and recognized in the absence of the newer [`enabled`](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#enabled) attribute, but builders should migrate to use the new attribute name when possible. Installation scripts should try to handle this automatically.)
### V2 Updates:
A more complete list of updates [lives here](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/README.md#v2-updates). These are the ones most relevant to this builder:
* ConfigBuilder Parameters from AppSettings - This has been one of the most asked for features of these config builders. With V2, it is now possible to read initialization parameters for config builders from `appSettings`. Read more about it [here](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#appsettings-parameters).
* **[[Obsolete]] This has been superceded by the [enabled](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#enabled) tag.** (~~Base Optional Tag - The `optional` tag that some of the builders in this project employed in V1 has been moved into the base class and is now available on all key/value config builders.~~)

Просмотреть файл

@ -0,0 +1,30 @@
# Microsoft Key/Value Configuration Builders
[`ConfigurationBuilder`](https://docs.microsoft.com/en-us/dotnet/api/system.configuration.configurationbuilder?view=netframework-4.7.1)s are a feature of the full .Net Framework that were introduced in .Net 4.7.1. You can read about the concept in [this blog post](http://jeffreyfritz.com/2017/11/modern-configuration-for-asp-net-4-7-1-with-configurationbuilders/). While the ability to inject configuration at runtime now exists in .Net as of 4.7.1 with the `ConfiguraitonBuilder` feature, the framework itself does not ship with any pre-made builders in box.
The goal of this project is for Microsoft to provide a basic set of Configuration Builders that should make it easy for developers to leverage this feature in their apps. They are intended to address some of the basic dynamic/non-local configuration needs of applications as they move into a container and cloud focused environment.
The set of builders produced here are styled as "Key/Value Config Builders." The architecture of `ConfigurationBuilder` in the framework is actually quite flexible and can be leveraged to handle a great number of unique situations. To keep things as easy and as broadly applicable as possible though, this project focuses on simple key/value scenarios.
For more information about the builders featured in this project, to report bugs, or submit contributions, please refer to the github project page for [MicrosoftConfigurationBuilders](https://github.com/aspnet/MicrosoftConfigurationBuilders/).
### V3 Updates:
* :warning: ***Breaking Change*** - `Expand` mode is gone. It has been [replaced by `Token` mode](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#mode).
* `Utils.MapPath` - This was somewhat broken in ASP.Net scenarios previously. It should now reliably go against `Server.MapPath()` in ASP.Net scenarios. It has also been updated to fall back against the directory of the config file being processed when resolving the app root in the case of a `Configuration` object being created by `ConfigurationManager.OpenConfiguration*` API's rather than being part of a fully-initialized runtime configuration stack.
* Json use has migrated to use `System.Text.Json` instead of `Newtonsoft.Json`.
* The [Azure Config Builders](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#azure-config-builders) have been updated to require a newer minimum version of `Azure.Identity` by default which allows for more methods of connecting to Azure, such as **User-Assigned Managed Identity**, or **Client Certificate-based** via environment variables. Also a pair of overloads (`GetCredential` and `GetSecretClientOptions/GetConfigurationClientOptions`) have been added for users who need something more than `DefaultAzureCredential` with default client options can provide.
* Added *RecursionGuard* to help detect and prevent situations where a `ConfigurationBuilder` accessing values from a `ConfigurationSection` other than the one which it is currently processing could result in stack overflow.
* `optional` attribute is obsolete => [`enabled`](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#enabled) attribute which provides more versatility. (The `optional` attribute is still parsed and recognized in the absence of the newer [`enabled`](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#enabled) attribute, but builders should migrate to use the new attribute name when possible. Installation scripts should try to handle this automatically.)
* Character Mapping - Some config builders have had an internal mapping of characters that might exist in keys in the config file but are illegal in keys at the source. As more scenarios come to light and individual prefrences are not always unanimous, V3 instead adds the [`charMap`](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#charmap) attribute to allow this character mapping to work with all **KeyValueConfigBuilders** and to be handled in an easily configurable manner.
* `ConnectionStringsSectionHandler2` - A new section handler for the `<connectionStrings>` section has been included in the base package. This new handler will allow updating of both the 'connectionString' attribute as well as the 'providerName' attribute. It does require the builders and source of config data to be aware of this new ability though. The default section handler for the `<connectionStrings>` section has not been updated and remains as it was in previous versions, so apps wishing to take advantage of the new handler will have to wire it up in their config. More details can be found in the [SectionHandlers documentation](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/SetionHandlers.md#ConnectionStringsSectionHandler2).
* `AzureAppConfiguration` nuget package version is revved to match the rest of this suite of builders, rather than being 1 major version behind. (ie, `AzureAppConfiguration:3.0` now depends on `Base:3.0` rather than `AzureAppConfiguration:1.0` depending on `Base:2.0`)
### V2 Updates:
* Azure App Configuration Support - There is a [new builder](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#azureappconfigurationbuilder) for drawing values from the new Azure App Configuration service.
* ConfigBuilder Parameters from AppSettings - This has been one of the most asked for features of these config builders. With V2, it is now possible to read initialization parameters for config builders from `appSettings`. Read more about it [here](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#appsettings-parameters).
* Lazy Initialization - As part of the work to enable pulling config parameters from `appSettings`, these key/value configuration builders now support a lazy initialization model. Things that must happen immediately can be left in the existing `Initialize(name, config)` method, or builders can leverage the new `LazyInitialize(name, config)` method for things that can happen just before retrieving values. All builders in this project have been updated to be lazy whenever possible.
* Updateable Keys - Builders can now massage key names before inserting into config. The [AzureKeyVaultConfigBuilder](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#azurekeyvaultconfigbuilder) has been updated to use this feature to allow embedding 'version' tags in key names instead of applying a single 'version' tag to the builder. (Note: This is seperate from, and performed *after* prefix stripping.)
* **[[Obsolete]] This has been superceded by the [enabled](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/KeyValueConfigBuilders.md#enabled) tag.** (~~Base Optional Tag - The `optional` tag that some of the builders in this project employed in V1 has been moved into the base class and is now available on all key/value config builders.~~)
* Escaping Expanded Values - It is possible to xml-escape inserted values in ~~`Expand`~~`Token`(as of V3) mode now using the new [escapeExpandedValues](#escapeexpandedvalues) attribute.
* Section Handlers - This feature allows users to develop extensions that will apply key/value config to sections other than `appSettings` and `connectionStrings` if desired. Read more about this feature in the [Section Handlers](https://github.com/aspnet/MicrosoftConfigurationBuilders/blob/main/docs/SectionHandlers.md) segment below.

Двоичные данные
src/packages/assets/dotnet-icon.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 6.8 KiB

Просмотреть файл

@ -184,7 +184,11 @@ Common build targets overwrites.
<RebuildDependsOn>Clean;Build</RebuildDependsOn>
</PropertyGroup>
<Target Name="BeforeBuild" />
<Target Name="BeforeBuild">
<ItemGroup>
<NuGetContent Remove="@(NuGetContent)"/>
</ItemGroup>
</Target>
<Target Name="Build" DependsOnTargets="$(BuildDependsOn)" />
<Target Name="AfterBuild" />