-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Fix up project search scenarios when no option is provided #42860
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -32,7 +32,7 @@ public static string GetProject(string projectPath = null) | |||
return projectPath; | |||
} | |||
|
|||
var csprojFiles = Directory.EnumerateFileSystemEntries(Directory.GetCurrentDirectory(), "*.*proj", SearchOption.TopDirectoryOnly) | |||
var csprojFiles = Directory.EnumerateFileSystemEntries(Directory.GetCurrentDirectory(), "*.*proj", SearchOption.AllDirectories) |
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.
Is this guaranteed to find the top most *proj
? Like if my project was b.csproj
but had a folder a/
with an a.csproj
, that wouldn't be used instead?
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.
The current behavior will throw an error for the multiple project scenario as it only supports looking for a single project file within a sub-directory. We can do something like use the first project file it finds but I'm not sure that's the best option. It feels more sensible to force the user to be explicit if we cannot find something.
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.
We should likely just match whatever the behavior of user-secrets
is yes?
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.
user-secrets
only searches the current directory if we wanted to stick to that. This would mean that we wouldn't resolve the project file for the nested folder scenario mentioned in the original issue but we would provide a clearer error message.
Closes #42794.