Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add App.Config file in Console Application

I want to store the connection string and some parameters in app.config file which we generaly do for windows aplication but I can't find app.config file for console application. So how should I use this file, how to add this file or there is some other work arroud for the same functionality. I am working in console application

like image 644
Nits Avatar asked Aug 30 '10 04:08

Nits


People also ask

How can I add app config file in console application in Visual Studio 2019?

In Solution Explorer, right-click the project node, and then select Add > New Item. The Add New Item dialog box appears. Expand Installed > Visual C# Items. In the middle pane, select the Application Configuration File template.

How do I add a config file to .NET core console app?

In the Main method, add the following code: class Program { static void Main(string[] args) { //.... IConfiguration Config = new ConfigurationBuilder() . AddJsonFile("appSettings.

Can we add web config in console application?

as web. config, but for console and WinForms applications. To add one to your project, right-click the project in Solution Explorer, Add..., New Item... and pick "Application Configuration File" from the Templates box.


1 Answers

Right click on application->Go to Add->you will see the exact picture What i have attached here->Pick the Application Config File.alt text

like image 80
PrateekSaluja Avatar answered Sep 20 '22 15:09

PrateekSaluja