Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

use appsettings.json in console app

All that’s required is to add the following NuGet packages and an appsettings.json file.

Microsoft.Extensions.Configuration
Microsoft.Extensions.Configuration.FileExtensions
Microsoft.Extensions.Configuration.Json

The appsettings.json files “Copy to Output Directory” property should also be set to “Copy if newer” so that the application is able to access it when published.
Comment

appsettings in console application c#


<ItemGroup>
    <PackageReference Include="Microsoft.Extensions.Configuration" Version="3.1.3" />
    <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.3" />
    <PackageReference Include="Microsoft.Extensions.Hosting" Version="3.1.3" />
</ItemGroup>

Comment

appsettings in console application c#


{
    "SomeKey": "This is from Config!"
}

Comment

PREVIOUS NEXT
Code Example
Csharp :: linq where c# 
Csharp :: timespan format string c# 
Csharp :: how to add default value to combobox in wpf 
Csharp :: unity trigger not detecting collision 
Csharp :: what is c# used for 
Csharp :: unity 2d platformer movement script rigidbody 
Csharp :: out variable in c# 
Csharp :: c# movement script 
Csharp :: how to make the player look around in unity 3d 
Csharp :: IExtensionApplication autocad 
Csharp :: embed video to exe file with c# 
Csharp :: razor: show editable list 
Csharp :: c# boundingbox text 
Html :: html meta refresh 
Html :: default html template 
Html :: how to center text in svg 
Html :: HP cmd get computer serial number 
Html :: how to embed my website into Discord 
Html :: bootstrap 5 carousel disable autoplay 
Html :: taka html code 
Html :: add favicon html 
Html :: html text justify 
Html :: icon for about us font awesome 
Html :: sample html file 
Html :: open new tab html 
Html :: tailwind cdn v3 
Html :: event.preventdefault() in angular 
Html :: unmute html5 video jquery 
Html :: audio tag disable download 
Html :: web mdc cdn 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =