Unable to add app.config file in Visual Studio 2017?
Asked Answered
C

3

8

Working in Visual Studio 2017; I have added a class library in my project. Now I want to add an app.config file.

When I try to add by "Add new Item" but config file is missing from item list.

How can I do it?

Celloidin answered 4/5, 2018 at 17:51 Comment(3)
Are you on Mac/Windows?Anticholinergic
In my Mac, I can find it under Misc > Application Configuration FileAnticholinergic
I am using wondows.. prntscr.com/jebiqdCelloidin
T
2

Just right click your class library. Click on Add -> New Item and you should find Application Configuration file ClassLibraryProject ApplicationConfigFile

Note: If you have a solution without any project or all project are unloaded, you would not find the Application Configuration File

If you are missing visual studio templates,then Close all instance of Visual Studio and Open visual studio command prompt and type,

devenv /installvstemplates

Press Enter. Let the process be complete and now open visual studio. You will get all missing templates under Visual Studio installed templates.

Tempting answered 4/5, 2018 at 18:14 Comment(4)
What is your project type? And you are searching in online in the screenshot attached, its present in Visual c# items. My screenshot also is from VS2017 professional. Did you try to reinstall vs templatesTempting
I have a webForm type of project, Now I want to add a new project of type "Class Library".. And would like to add "App.config" in class library.... But can't find it when 'Add new item".Celloidin
I tried creating webForm Type project and then added new project of "Class Library" I can find "App.config" in 'Add new Item'. Try reinstalling VS2017Tempting
Thanks @akshay-bheda, I reinstalled and now I can see App.config file.Celloidin
C
14

You probably forgot to install workload .NET desktop development.

Go to installation, click to modify and include the workload .NET desktop development.

Check image of installation screen

Cordie answered 12/8, 2018 at 3:14 Comment(1)
Thanks Rafael.. that was exactly my issue.. I had initially set things up for web development and .net code, but recently went to build a class lib and couldn't find the app.config template (i did add one manually, but after adding desktop can now add a file via the new templates!!!) thanks again.Buttonball
T
2

Just right click your class library. Click on Add -> New Item and you should find Application Configuration file ClassLibraryProject ApplicationConfigFile

Note: If you have a solution without any project or all project are unloaded, you would not find the Application Configuration File

If you are missing visual studio templates,then Close all instance of Visual Studio and Open visual studio command prompt and type,

devenv /installvstemplates

Press Enter. Let the process be complete and now open visual studio. You will get all missing templates under Visual Studio installed templates.

Tempting answered 4/5, 2018 at 18:14 Comment(4)
What is your project type? And you are searching in online in the screenshot attached, its present in Visual c# items. My screenshot also is from VS2017 professional. Did you try to reinstall vs templatesTempting
I have a webForm type of project, Now I want to add a new project of type "Class Library".. And would like to add "App.config" in class library.... But can't find it when 'Add new item".Celloidin
I tried creating webForm Type project and then added new project of "Class Library" I can find "App.config" in 'Add new Item'. Try reinstalling VS2017Tempting
Thanks @akshay-bheda, I reinstalled and now I can see App.config file.Celloidin
G
1

I couldn't add app.config using the GUI tools for my web project. However, I have added the app.config file manually and the build process picked it up and used it.

Gullet answered 8/4, 2020 at 21:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.