Visual Studio, Why Won't You Let Me Have This One (Solution Folder)?

Organizations are always subjective, sometimes multiple projects are enough, sometimes it can help to organize code into things like Solution Folders, which you'd imagine would be pretty simple - but that's not always the case as you'll soon see...

If you've ever worked in a large code-base of around a hundred or so projects, then you know that organizing your code can almost be as important as writing the code itself. The organization is always subjective, sometimes multiple projects are enough, sometimes it can help to organize code into things like Solution Folders, which you'd imagine would be pretty simple - but that's not always the case as you'll soon see.

Naming is hard; Naming Solution Folders is impossible

While it's well documented that naming things in software is challenging, you can generally come to a consensus amongst your team on what to name something. Apparently, solution folders in Visual Studio are completely different animals and the flagship IDE simply won't let you name a solution folder the same as an entity that exists within your project already,

 

Visual Studio, Why Won't You Let Me Have This One (Solution Folder)?

 

After a bit of searching around - I wasn't really able to come across a clear cut solution or workaround, so I decided to write up a short post on one that I came across. Basically, Visual Studio has a bit of trouble attempting to create a logical folder of a given name when a physical folder (or some other entity like a project file) shares that same name. The trick here is to simply create a new Solution Folder with a throwaway name,

Visual Studio, Why Won't You Let Me Have This One (Solution Folder)?

Then move the contents into the folder that you'd like (at least the entity with the conflicting name),

Visual Studio, Why Won't You Let Me Have This One (Solution Folder)?

Finally, safely rename the folder to the name of your choosing,

Visual Studio, Why Won't You Let Me Have This One (Solution Folder)?

And that's it! Now, you can easily organize your larger projects and solutions, regardless of the name that you intend and if it conflicts with other entities in your project.