How to add folders structure in VS2015?

2020-07-17 05:11发布

问题:

In older versions of VS when you dragged a folder from windows file explorer into your VS solution, it would make a reference to that folder including all the sub folders' structure and files. In VS2015 when I drag a folder into the solution it simpley makes a reference to all the files in that folder and sub folder but ignore the folder structure. So it dumps all the files reference under one filter.

Is there a way to get the former behavior in VS2015?

回答1:

The way that I do this is to add the folders to the project structure (i.e. underneath the .sln file) and then enable "Show All Files" (you may need a "Refresh").

Right click the folders you want to add and click "Include In Project".

(I didn't know about the drag and drop!)



回答2:

The answer is as follows:

the reason you don't see the "include in project" is : either you created the solution externally to visual studio community or the solution got corrupt

to resolve this:

  1. make a backup the solution (just in case)
  2. in solution explorer - right click the project name , and choose "Rebuil solution"
  3. Press the "show all files" (if not pressed already)
  4. go to the folder you want to include, and now you should see the "include in project" option. Choose it
  5. press again the "show all files" button (on top of the "solution explorer") to once again hide irrelevant files/folders from your solution explorer


回答3:

Working with VS2015 and SSIS Solution: Miscellaneous Folder - When I created a Sub-Folder in VS2015 and then Added the files contained therein it added them but not with the Name I Had but the name "Miscellaneous". Not how it worked in previous versions!

I was able to Add a Custom-Named Folder to the Solution but not the Project. When adding existing files to the Project it put them under the aforementioned Miscellaneous Folder.