dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.71k stars 1.06k forks source link

`dotnet sln add` can create parent solution folders when adding existing projects #26064

Open peteraritchie opened 2 years ago

peteraritchie commented 2 years ago

https://github.com/dotnet/sdk/blob/b054239026f9be94e55a72586d4be1637599abd2/src/Cli/dotnet/SlnFileExtensions.cs#L19

Adding an existing project to a solution can have different behavior than Visual Studio does, in that if I add an existing project to a solution in Visual Studio, a solution folder isn't automatically created if the project is in a nested folder (e.g. .\Tests\Api.Tests\Api.Tests.csproj, where the created solution folder would be "Tests").

There's currently no way to do the same thing as Visual Studio via dotnet CLI. I'm curious about the impetus for this design choice?

baronfel commented 2 years ago

Do you mean that we should create solution folders for the intermediate folders, or that we should not create such folders?

peteraritchie commented 2 years ago

It creates such folders now; so I'm wondering why (not entirely sure about it should not yet) it does create such folders now. i.e., there is no precedent that I can find.

marcpopMSFT commented 2 years ago

We're not sure the history here so I don't have a good answer for you. Currently we're not prioritizing sln issues and improvements at the moment but will look for an opportunity in the future.