79679664

Date: 2025-06-25 21:06:42
Score: 0.5
Natty:
Report link

There is a direct way of adding sources, resources, headers from folders nested in a Visual Studio projects directory.

In the toolbar of Solution Explorer, click "Show All Files".
An screenshot of Solution Explorer Toolbar showing Show All Files button

Next right click the folder you need and select "Include in Project".
An screenshot of Solution Explorer showing Include In Project Context Option

Now Visual Studio will not automatically scan this folder again and again. So we have two kinds of options.

  1. If you are moving sources and headers from somewhere to these folders, just include the folders once again and Visual Studio will add them. This will however include all files in the folder that you manually removed from the project yourself.

  2. If you want to create a new file in that folder from Solution Explorer, either

    1. In the "Show All Files" view, add by right clicking on the folder and selecting Add option.

    2. In the Default view, include the path along with the filename when select Add option. So instead of entering MyFile.cpp, it goes src/MyFile.cpp. Visual Studio will create any required folders in there is not.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (0.5):
Posted by: Subham Burnwal