already starting off more right

This commit is contained in:
Adam R. Grey 2021-06-08 07:10:24 -04:00
parent c2d527e1a4
commit bb1cd7bc10
4 changed files with 21 additions and 1 deletions

1
.gitignore vendored
View File

@ -11,3 +11,4 @@ obj/
# Local History for Visual Studio Code
.history/
appsettings.json

View File

@ -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
View File

@ -0,0 +1,3 @@
{
"name": "guy who didn't configure"
}

View File

@ -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>