Skip to content

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

Merged
merged 2 commits into from
Jul 26, 2022

Conversation

captainsafia
Copy link
Member

Closes #42794.

@captainsafia captainsafia added old-area-web-frameworks-do-not-use *DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels feature-userjwts The `dotnet user-jwts` CLI tool labels Jul 21, 2022
@captainsafia captainsafia requested a review from a team July 21, 2022 20:18
@captainsafia captainsafia requested a review from Pilchie as a code owner July 21, 2022 20:18
@ghost ghost added the area-commandlinetools Includes: Command line tools, dotnet-dev-certs, dotnet-user-jwts, and OpenAPI label Jul 21, 2022
@@ -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)
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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?

Copy link
Member Author

@captainsafia captainsafia Jul 21, 2022

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.

@captainsafia captainsafia merged commit 1380236 into main Jul 26, 2022
@captainsafia captainsafia deleted the cs/user-jwts-path-fix branch July 26, 2022 15:50
@ghost ghost added this to the 7.0-rc1 milestone Jul 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-commandlinetools Includes: Command line tools, dotnet-dev-certs, dotnet-user-jwts, and OpenAPI feature-userjwts The `dotnet user-jwts` CLI tool old-area-web-frameworks-do-not-use *DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

user-jwts prints error message on path1
3 participants