How to use New Solution Folder and Directory correctly

I have a feeling I'm doing something wrong but can't figure out the way I'm supposed to do this.

If I create a new Solution Folder the folder gets added to my solution and appears in the project tree, but it doesn't create the folder on disk. If I create a new Directory in Files view, it creates a folder on disk but it doesn't appear in the project in Solution view.

For now I'm creating every folder/directory twice (once in File view and once in Solution view) but that can't be right, can it?

1
1 comment

Hello Julian,

Thank you for contacting Rider support. It is actually by design. The Solution Folder isn't a real directory. It organizes projects in the solution only; It doesn't imply the filesystem.

Relationships between projects and Solution Folders are declared in the .sln file where the Solution Folder is a project of a specific type:

Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionFolder1", "SolutionFolder1", "{D9C9CE8A-0E54-4753-9247-C9E7E285713F}"

The project belonging to a solution folder is specified in the GlobalSection(NestedProjects) = preSolution section.
Considering the ConsoleApp2 is under the SolutionFolder1:

Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp2", "ConsoleApp2\ConsoleApp2.csproj", "{55D2CE82-AD12-4077-9948-BF518B5784E9}"

, its GUID is bundled with GUID of SolutionFolder1 in the NestedProjects section:

GlobalSection(NestedProjects) = preSolution
{55D2CE82-AD12-4077-9948-BF518B5784E9} = {D9C9CE8A-0E54-4753-9247-C9E7E285713F}
EndGlobalSection

Physical directories need to be created separate. If you wish to create a project inside a Solution Folder (having a real directory with the name of Solution Folder):

  • Ensure to have a desired Solution Folder created;
  • Right-click on it and select “Add | New Project”;
  • In the window opened ensure to specify the real path you desire a project to be created under:

  • That way you will have a physical directory matching to Solution Folder.

You might find this article helpful: SUPPORT-A-2593 Adding project does not load relative path

Hope that clears the situation.

1

Please sign in to leave a comment.