How to add App.Config file in Console Application

Viewed 74887

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

5 Answers

Anyone using VS2017 above and if you are not seeing the option highlighted in image Application Config File Then most probably you have not installed .net desktop development tools.

The application configuration file template comes from .net desktop development workload, so you need to make sure you've installed it in VS2019/VS2022.(Go tools=>get tools and features=>make sure you have .net desktop development workload checked. Or Use Visual Studio Installer to install the required package.

Had the same problem, just open the Project tab and press Add Form (Windows Forms) then search for config and you will find app.config

Related