filmov
tv
06 - .NET Core Console Application - AppSettings
Показать описание
Let's add an app settings dot json file to the Sameworks Project.
• We'll right-click on the project
• Add a new item
• Scroll to find JavaScript JSON Configuration File
Because this file is not part of the build and doesn't get compiled into the code we have to tell the build process to copy it into the same directory where the compiled executables will exist. We'll do so by:
• Select properties
• Change the [Copy to Output Directory] to [Copy Always] or [Copy if newer]
○ It's your choice
○ I prefer [Copy Always]
We'll clear out the contents of the file and replace the body with:
• ConnectionStrings - as you can tell it's a JSON Format
• In ConnectionStrings we'll add a "DefaultConnection"
○ We'll include a value that resembles a valid connection string
• Context
• Configuration
• Optional = true: in case the file doesn't exist
• Reload on Change = true: allows you modify the file while the app is running and reloads the settings automatically.
We'll log it out to the console using a little string interpolation.
Let's run it and see if it works.
In the next video we'll talk about Command Line Arguments… We'll see you there.
• We'll right-click on the project
• Add a new item
• Scroll to find JavaScript JSON Configuration File
Because this file is not part of the build and doesn't get compiled into the code we have to tell the build process to copy it into the same directory where the compiled executables will exist. We'll do so by:
• Select properties
• Change the [Copy to Output Directory] to [Copy Always] or [Copy if newer]
○ It's your choice
○ I prefer [Copy Always]
We'll clear out the contents of the file and replace the body with:
• ConnectionStrings - as you can tell it's a JSON Format
• In ConnectionStrings we'll add a "DefaultConnection"
○ We'll include a value that resembles a valid connection string
• Context
• Configuration
• Optional = true: in case the file doesn't exist
• Reload on Change = true: allows you modify the file while the app is running and reloads the settings automatically.
We'll log it out to the console using a little string interpolation.
Let's run it and see if it works.
In the next video we'll talk about Command Line Arguments… We'll see you there.
06 - .NET Core Console Application - AppSettings
Intro to Console Apps in C# in .NET 6
Dotnet 6 Tutorial | How to Create Console Core Project in .Net 6
.NET 6 - Console App (First Program)
09 - .NET Core Console Application - Environment Variables
publishing and running a NET Core 6 console app
.Net 6 New features | Console application changes in Visual Studio 2022
appsetting.json In Console App - Using Dependency Injection In .NET Core
Master OpenAI GPT-4 & Gmail API with RAG using C# .NET to Automate Email Reply to Boost Producti...
.NET Core Console App with Dependency Injection, Logging, and Settings
launching vs 2022 and creating a NET Core 6 console app
debugging a NET Core 6 console app
Continuous running background job in .NET 6 Console Application [Can run in a Docker Container]
How to Create Console Application using Net 6 and Visual studio 2022?
.Net Core Create C# Console App
Console Application Using c#.NET Core
.NET Core Docker Container | C# Docker Console Application
Visual Studio 2019 - Create A New Console App In .NET Core
07 - .NET Core Console Application - Command Line Arguments
💜 How To Schedule .NET 7 8 9 C# Console App... Easily & Efficiently
09 CRUD with NET Core Console and SQLite
.Net 8.0, Read settings from appSettings.json file in console application
First .Net Core Console Application
Create .NET 6 Console Application Using C# 10 and Visual Studio 2022 | Basic Beginner's Tutoria...
Комментарии