Flash.Configuration.Wpf
8.0.0
dotnet add package Flash.Configuration.Wpf --version 8.0.0
NuGet\Install-Package Flash.Configuration.Wpf -Version 8.0.0
<PackageReference Include="Flash.Configuration.Wpf" Version="8.0.0" />
<PackageVersion Include="Flash.Configuration.Wpf" Version="8.0.0" />
<PackageReference Include="Flash.Configuration.Wpf" />
paket add Flash.Configuration.Wpf --version 8.0.0
#r "nuget: Flash.Configuration.Wpf, 8.0.0"
#addin nuget:?package=Flash.Configuration.Wpf&version=8.0.0
#tool nuget:?package=Flash.Configuration.Wpf&version=8.0.0
Flash.Configuration.Wpf
Flash.Configuration.Wpf is a configuration management tool that enables dynamic parsing and updating of configuration settings, including updating configuration files after build.
Features
- Dynamic configuration parsing: Supports parsing configuration files in JSON format. Extracts and structures configuration data for easy access.
- Automatic configuration updates: Updates configuration files dynamically based on specified rules. Ensures configurations remain up to date without manual intervention.
- Post-Build configuration handling: Automatically modifies configuration files after the application build process. Useful for adapting settings to different environments (e.g., development, staging, production).
- Environment-specific configurations: Manages different configuration files based on the target deployment environment. Allows seamless switching between settings for different use cases.
- Validation and Error Handling: Includes built-in validation mechanisms to detect and report misconfigurations. Logs errors and warnings for troubleshooting issues.
- Extensibility and Customization: Allows developers to define custom processing rules for configurations. Supports plug-in extensions to enhance functionality.
Getting Started
Installation
To add the latest NuGet package:
Install-Package Flash.Configuration.Wpf --version 8.0.0
or
dotnet add package Flash.Configuration.Wpf --version 8.0.0
The package can work with the following project types:
- Windows Forms App
- Windows Forms Class Library
Prerequisites
- .NET 8 or higher.
- ⚠️ Warning The project should have the following framework
<TargetFramework>net8.0-windows10.0.19041</TargetFramework>
instead<TargetFramework>net8.0-windows</TargetFramework>
Usage
Create a class for configuration
Sample
[FlashOrder(4)]
[FlashConfig("ConnectionStrings", environment: "Development")]
[FlashConfig("ConnectionStrings", environment: "Staging")]
public class ConnectionStrings
{
[FlashProperty("DefaultConnection")]
[FlashValue("Server=dev.localhost;Database=dev_db;User Id=dev_user;Password=******;", environment: "Development")]
[FlashValue("Server=staging.localhost;Database=staging_db;User Id=staging_user;Password=******;",
environment: "Staging")]
public string DefaultConnection { get; } = string.Empty;
[FlashIgnore]
[FlashProperty("Enabled")]
[FlashValue(false, environment: "Development")]
[FlashValue(true, environment: "Staging")]
public bool Enabled { get; }
}
- Add the following configuration files to the project:
appsettings.Development.json
appsettings.Staging.json
- Build the project;
- The configuration files should be updated:
appsettings.Development.json
{ "Logging": { "LogLevel": { "Default": "Information", "Microsoft.AspNetCore": "Warning" } }, "ConnectionStrings": { "DefaultConnection": "Server=dev.localhost;Database=dev_db;User Id=dev_user;Password=******;" } }
appsettings.Staging.json
{ "Logging": { "LogLevel": { "Default": "Debug", "System": "Information", "Microsoft": "Information" } }, "ConnectionStrings": { "DefaultConnection": "Server=staging.localhost;Database=staging_db;User Id=staging_user;Password=******;" } }
- The configuration files should be updated:
Advanced usage
⚠️ Warning The advanced complex sample is available with the link with all classes and configuration files.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0-windows10.0.19041 is compatible. net9.0-windows was computed. |
-
net8.0-windows10.0.19041
- No dependencies.
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 |
---|---|---|
8.0.0 | 118 | 2/23/2025 |
- Added support for .NET 8.0;
- Added support WPF Applications.