-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fix bug when adding solution folder containing ..
#46456
Fix bug when adding solution folder containing ..
#46456
Conversation
..
Did we finalize the design on this, or is it still being discussed? |
a0507b7
to
c043f68
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm very confused here. ..
is a valid path navigator, just like .
.
.
is current working directory..
is the parent of the current working directory
I looked at the work item, and them specifying ..\RazorClassLibrary1\RazorClassLibrary1.csproj
is completely normal use case. In English, it means "From the directory above the current directory, go into the RazorClassLibrary1 folder and use the RazorClassLibrary1.csproj file."
@MiYanni Relative path gets resolved correctly, but the issue occurs when dynamically generating solution folders (ie, not actual disk folders) Hence, the expected behavior is that when adding projects from parent directories, no solution folder should be generated. This mimics previous behavior from 9.0.1xx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, now I understand the situation. I completely misunderstood that "solution folder" meant "the feature for solutions to contain virtual folders" and not "the folder a solution is in".
I guess in this situation, the user could intend to have a project defined in a solution folder, correct? I'm still slightly confused that there is a feature to automatically create a solution folder based on the path provided. But I don't know this CLI interface at all.
Either way, I can see this is a very targeted fix, but why is ..
special in this situation? Couldn't you just check to see if this is a valid relative path? I think we have SDK methods for that.
Yes, by default the CLI generates solution folders automatically when adding a project based on its path. Hence, There are other situations in which users might create solution folders with invalid names that we currently don't handle, but this is a special case because we still want to support adding projects from parent directories |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the explanation! I looked the docs on add to get a better understanding. I see now. Given all that, this change looks good.
Glad it helped, thanks! |
Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2321742
When attempting to add a project in a parent directory (e.g.,
dotnet sln add ../foo/bar.csproj
), the tool automatically generates solution folder../foo
. vs-solutionpersistence generates folders and subfolders dynamically, causing a folder..
to be created.When adding projects from outside the solution directory, the tool should not create solution folders.