-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Search for slnx files when setting solution-relative content root #61305
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
base: main
Are you sure you want to change the base?
Conversation
Thanks for your PR, @@kimsey0. Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
@@ -126,7 +126,7 @@ public static IWebHostBuilder ConfigureTestContainer<TContainer>(this IWebHostBu | |||
public static IWebHostBuilder UseSolutionRelativeContentRoot( | |||
this IWebHostBuilder builder, | |||
string solutionRelativePath, | |||
string solutionName = "*.sln") | |||
string solutionName = "*.sln?") |
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.
This probably isn't a good idea, since it also matches solution filter files (.slnf
).
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 can think of a few options:
- Add another overload for the
UseSolutionRelativeContentRoot
method that takes in a list ofsolutionNames
and default to["*.sln", "*.slnx"]
. Then we make different calls toDirectory.EnumerateFiles
and stop on the first return. - If the
solutionName
param is*.sln
and theEnumerateFiles
call does not return, do an extra lookup for*.slnx
. - The inverse of 2, and defaulting the parameter to
*.slnx
. - Use your new default of
*.sln?
and filter solution filter files (.slnf
) or any other than.sln, .slnx
, ifsolutionName
has the default value.
I think I like option 3 the most.
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 problem with 1 is that, since the parameters are both optional, there will be a conflict between the overloads. That could maybe be solved with OverloadResolutionPriorityAttribute, but that only works from .NET 9.
2 and 3 are a little weird, since the parameter that you pass in doesn't match the behavior.
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.
2 and 3 are a bit weird, but even if it's not explicit, sln and slnx are analogous. Maybe do 2 and 3?
Search for slnx files when setting solution-relative content root
Fixes #61304