I have a free standing set of files not affiliated with any C# project at all that reside in a complicated nested directory structure.
I want to add them in that for
This is what I do:
Then everything will be added on your solution from folders to files, and files inside those folders.
Enable "Show All Files" for the specific project (you might need to hit "Refresh" to see them)**.
The folders/files that are not part of your project appear slightly "lighter" in the project tree.
Right click the folders/files you want to add and click "Include In Project". It will recursively add folders/files to the project.
** These buttons are located on the mini Solution Explorer toolbar.
** Make sure you are NOT in debug mode.
In Solution Explorer:
I use this to install add-ons like HTML editors and third-party file browsers.
There is now an open-source extension in the Marketplace that seems to do what the OP was asking for:
Folder To Solution Folder
If it doesn't do exactly what you want, the code is available, so you can modify it to suit your scenario.
HTH
At last, Visual Studio 2017 allows the user to import an entire directory with a single click. Visual Studio 2017 has a new functionality "Open Folder" that allows opening the entire folder, even without the need to save it as solution. The source code can be imported using the following methods.
devenv.exe <source folder>
It even supports building and debugging CMake projects.
Bring your C++ codebase to Visual Studio with “Open Folder”
What worked for me was to drag the folder into Visual Studio, then right click the folder and select "Open Folder in File Explorer". Then select all and drag them into the folder in Visual Studio.