From bb1cd7bc10d5e02e19005bfe41feccce564e27b2 Mon Sep 17 00:00:00 2001 From: "Adam R. Grey" Date: Tue, 8 Jun 2021 07:10:24 -0400 Subject: [PATCH] already starting off more right --- .gitignore | 1 + Program.cs | 7 ++++++- appsettings.example.json | 3 +++ directors-assistant.csproj | 11 +++++++++++ 4 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 appsettings.example.json diff --git a/.gitignore b/.gitignore index 78d58a9..a2c3b1d 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ obj/ # Local History for Visual Studio Code .history/ +appsettings.json diff --git a/Program.cs b/Program.cs index 1623753..ddbec3c 100644 --- a/Program.cs +++ b/Program.cs @@ -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}!"); } } } diff --git a/appsettings.example.json b/appsettings.example.json new file mode 100644 index 0000000..cef6d5d --- /dev/null +++ b/appsettings.example.json @@ -0,0 +1,3 @@ +{ + "name": "guy who didn't configure" +} \ No newline at end of file diff --git a/directors-assistant.csproj b/directors-assistant.csproj index 49d259e..b09ab0a 100644 --- a/directors-assistant.csproj +++ b/directors-assistant.csproj @@ -6,4 +6,15 @@ directors_assistant + + + + + + + + + Always + +