ConfigGenerator 1.0.4
dotnet add package ConfigGenerator --version 1.0.4
NuGet\Install-Package ConfigGenerator -Version 1.0.4
<PackageReference Include="ConfigGenerator" Version="1.0.4" />
<PackageVersion Include="ConfigGenerator" Version="1.0.4" />
<PackageReference Include="ConfigGenerator" />
paket add ConfigGenerator --version 1.0.4
#r "nuget: ConfigGenerator, 1.0.4"
#:package ConfigGenerator@1.0.4
#addin nuget:?package=ConfigGenerator&version=1.0.4
#tool nuget:?package=ConfigGenerator&version=1.0.4
Source Generator for generating POCO classes based on your appsettings.json files
This Source Generator generates POCO's based on your appsettings.json files. It also supports multiple settings files: appsettings.json + appsettings.Development.json + appsettings.Production.json, etc.
- Add the appsettings.json files to your
.csproj
like this:
<ItemGroup>
<AdditionalFiles Include="appsettings.json" />
<AdditionalFiles Include="appsettings.Development.json" />
</ItemGroup>
You can add as many appsettings files as you want 😃
- The config classes are generated in the namespace
ApplicationConfig
(This will be configurable in the next release). - Register your config in the DI container:
builder.Services.Configure<ApplicationConfig.MyAppConfig>(builder.Configuration);
- Inject the config in your constructor:
IOptions<ApplicationConfig.MyAppConfig> options
⚠️ You may have to restart Visual Studio after installing this NuGet package!
See this blogpost for more information:
https://albertromkes.com/2020/11/04/a-source-generator-for-your-appsettings-json/
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- 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.