WPF.Appsettings
1.0.0
dotnet add package WPF.Appsettings --version 1.0.0
NuGet\Install-Package WPF.Appsettings -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WPF.Appsettings" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add WPF.Appsettings --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: WPF.Appsettings, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install WPF.Appsettings as a Cake Addin
#addin nuget:?package=WPF.Appsettings&version=1.0.0
// Install WPF.Appsettings as a Cake Tool
#tool nuget:?package=WPF.Appsettings&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
WPF.Appsettings - WPF
NuGet aiming to make it easier to use Microsoft.Extensions.Logging in WPF applications
Usage
Define WPF_ENVIRONMENT
as an environment variable. For development this is typically Development
:
<ItemGroup>
<EmbeddedResource Include="appsettings.json" />
<EmbeddedResource Include="appsettings.Development.json" Condition="'$(WPF_ENVIRONMENT)' == 'Development'" />
<EmbeddedResource Include="appsettings.secrets.json" />
</ItemGroup>
You can then run this code to load one or two appsettings.json
files with this code:
public sealed partial class App
{
private static IConfiguration Configuration { get; } = new ConfigurationBuilder().AddAppsettings().Build();
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
// From here, configuration is used exactly like in ASP.NET Core (minus the dependency injection of course)
Debug.WriteLine(Configuration["Logging:LogLevel:Default"]);
}
}
All appsettings.json
files matching the following regex will be loaded:
(?<app_name>(?:\w+\.?)+)\.appsettings(?<environment>\.\w+)?\.json
Load order
appsettings.json
appsettings.{WPF_ENVIRONMENT}.json
appsettings.local.json
Committing
Important to run this before committing (assuming you have GPG key set up)
git config commit.gpgsign true
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net7.0
- Microsoft.Extensions.Configuration.Binder (>= 7.0.4)
- Microsoft.Extensions.Configuration.Json (>= 7.0.0)
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.0.0 | 135 | 6/4/2023 |