already starting off more right
This commit is contained in:
parent
c2d527e1a4
commit
bb1cd7bc10
1
.gitignore
vendored
1
.gitignore
vendored
@ -11,3 +11,4 @@ obj/
|
||||
# Local History for Visual Studio Code
|
||||
.history/
|
||||
|
||||
appsettings.json
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace directors_assistant
|
||||
{
|
||||
@ -6,7 +7,11 @@ namespace directors_assistant
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("Hello World!");
|
||||
var config = new ConfigurationBuilder()
|
||||
.AddJsonFile("appsettings.json", true, true)
|
||||
.Build();
|
||||
var name = config["name"];
|
||||
Console.WriteLine($"Hello {name}!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
3
appsettings.example.json
Normal file
3
appsettings.example.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"name": "guy who didn't configure"
|
||||
}
|
@ -6,4 +6,15 @@
|
||||
<RootNamespace>directors_assistant</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="5.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="AppSettings.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
Loading…
Reference in New Issue
Block a user