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
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.
In the Main method, add the following code: class Program { static void Main(string[] args) { //.... IConfiguration Config = new ConfigurationBuilder() . AddJsonFile("appSettings.
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.
Right click on application->Go to Add->you will see the exact picture What i have attached here->Pick the Application Config File.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With