Skip to main content

NotNot.AppSettings by jasonswearingen

Nuget GitHub last commit GitHub Repo stars

Details​

Info​

info

Name: NotNot.AppSettings

Auto-generate strongly typed C# settings objects from your AppSettings.json.

Author: jasonswearingen

NuGet: https://www.nuget.org/packages/NotNot.AppSettings/

You can find more details at https://github.com/jasonswearingen/NotNot.AppSettings/

Source: https://github.com/jasonswearingen/NotNot.AppSettings/tree/main

Original Readme​

note

About​

note

Application Settings to strongly typed classes. Generate also from AppSettings development

How to use​

Example (source csproj, source files)​

This is the CSharp Project that references NotNot.AppSettings

<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<InvariantGlobalization>true</InvariantGlobalization>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.1" />
<PackageReference Include="NotNot.AppSettings" Version="1.0.0" OutputItemType="Analyzer" ReferenceOutputAssembly="true" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
</ItemGroup>

<ItemGroup>
<AdditionalFiles Update="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</AdditionalFiles>
</ItemGroup>
<PropertyGroup>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)\GX</CompilerGeneratedFilesOutputPath>
</PropertyGroup>
</Project>

Generated Files​

Those are taken from $(BaseIntermediateOutputPath)\GX


/**
* This file is generated by the NotNot.AppSettings nuget package.
* Do not edit this file directly, instead edit the appsettings.json files and rebuild the project.
**/
using System;
using System.Runtime.CompilerServices;
namespace TestAppSettings.AppSettingsGen;

[CompilerGenerated]
public partial class AppSettings {
public TestAppSettings.AppSettingsGen._AppSettings.Logging? Logging{get; set;}
public string? AllowedHosts{get; set;}
public string? AppName{get; set;}

}

Useful​

Download Example (.NET C# )​

Share NotNot.AppSettings​

https://ignatandrei.github.io/RSCG_Examples/v2/docs/NotNot.AppSettings

In the same category (FilesToCode)​

Chorn.EmbeddedResourceAccessGenerator​

EmbedResourceCSharp​

Podimo.ConstEmbed​

ResXGenerator​

RSCG_Utils​

ThisAssembly_Resources​