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
                    
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="Flash.Configuration.Wpf" Version="8.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Flash.Configuration.Wpf" Version="8.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Flash.Configuration.Wpf" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Flash.Configuration.Wpf --version 8.0.0
                    
#r "nuget: Flash.Configuration.Wpf, 8.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.
#addin nuget:?package=Flash.Configuration.Wpf&version=8.0.0
                    
Install Flash.Configuration.Wpf as a Cake Addin
#tool nuget:?package=Flash.Configuration.Wpf&version=8.0.0
                    
Install Flash.Configuration.Wpf as a Cake Tool

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=******;"
          }
      }
      

Advanced usage

⚠️ Warning The advanced complex sample is available with the link with all classes and configuration files.

Product Compatible and additional computed target framework versions.
.NET net8.0-windows10.0.19041 is compatible.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • 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.