Visual Studio Solutions Folder as real Folders

2019-01-07 10:00发布

I have a Visual Studio Solution. Currently, it is an empty solution (=no projects) and I have added a few solution folders.

Solution Folders only seem to be "virtual folders", because they are not really created in the Filesystem and files inside solution folders are just sitting in the same folder as the .sln file.

Is there a setting that i've overlooked that tells Visual Studio to treat Solution Folders as "real" folders, that is to create them in the file system and move files into it when I move them inside the solution into one of those folders?

Edit: Thanks. Going to make a suggestion for VS2010 then :)

13条回答
The star\"
2楼-- · 2019-01-07 10:20

Create "Solution folder". This will create logical folder, but not physical one. Right click to the solution folder and open a new project dialog. But before you click OK, you have to change a project location to your desired physical folder and VS will create it and place the project inside.

查看更多
一夜七次
3楼-- · 2019-01-07 10:25

No special setting. I don't think it's supported.

You can create real folders in a "project" within the solution, but not in the solution itself.

查看更多
倾城 Initia
4楼-- · 2019-01-07 10:27

Sara Ford contributed a Macro to add do this. In Visual Studio 2010, if you open your Macro Explorer, you will see a macro called "GenerateSlnFolderOnDirStructure." This will automate the creation of the Solution Folders and add the files.

查看更多
淡お忘
5楼-- · 2019-01-07 10:27

Visual studio has no support for this. I made an extension that does something similar for VS2013 though. It maps solution folders to physical folders on your hard drive, though the mapping is one way (from hard drive to solution). That means a solution folder's contents will reflect the hard drive folder's contents, and not the other way.

With that out of the way, the extension may still be useful. It has support for mapping solution folders to physical folders, filtering files and directories based on regex, and remembering mappings in your .sln file. Properties are non-intrusive so developers without the extension can still open the sln and not be affected.

Hosted on visual studio gallery: https://visualstudiogallery.msdn.microsoft.com/69e19ea6-4442-4cb6-b300-044dd21f02bd

Edit: Uploaded to bitbucket. Now open source. MIT license. https://bitbucket.org/LSS_NorthWind/physical-solution-folders

查看更多
甜甜的少女心
6楼-- · 2019-01-07 10:28

Note: Yes this is possible you can create a folder on root but its lil bit tricky....

By giving some extra efforts you can do it How? Lets follow the step--

  • 1-Create Folder eg: "newfolder" on root (where your .sln file reside).
  • 2.Copy and paste your projects inside the folder.
  • 3.go to your sln file and find moved projects and append newfolder\ in moved project's address.
  • 4.Save sln file.
  • 5.Open your project and Commit the repository in git or so...
  • 6.Take the repository on fresh location.

    YOU are done...

if still you are not able to see your folder -----

  • 1.Add a solution folder xyz.
  • 2.Open sln file and change that folder name with your folder name.

Congrats you are done..

If you face any problem just write me for help..

查看更多
爷的心禁止访问
7楼-- · 2019-01-07 10:30

The folder created underneath the solution will be virtual as said. Maybe this might be called a workaround but you can physically create the folder on disk either before or when you add new item/project and Robert should be a sibling of your dad.

ps- on closer look maybe i should explain "bob's your uncle" means your fine/sorted.

查看更多
登录 后发表回答