`DotNetSlnList` hardcodes English output
Prerequisites
- [x] I have written a descriptive issue title
- [x] I have searched issues to ensure it has not already been reported
Cake runner
Cake Frosting
Cake version
5.1.0
Operating system
Windows
Operating system architecture
x64
CI Server
No response
What are you seeing?
When running context.DotNetSlnList(SolutionFile), no projects are returned. This seems to be because the output is parsed in DotNetSlnLister.ParseResult, but it expects Project(s). If the machine is configured with a different locale, it obviously doesn't match and nothing is returned.
What is expected?
All projects are listed independent of the system's locale
Steps to Reproduce
- Configure a different locale than English.
- Call
context.DotNetSlnList() - Observe that this solution contains no projects.
Output log
No response
Does it work for you if you specify cli language, i.e.
var projects = DotNetSlnList(
".",
new DotNetSlnListSettings
{
EnvironmentVariables =
{
{ "DOTNET_CLI_UI_LANGUAGE", "en" }
}
}
);
if so that would be a current workaround, and maybe should be added by default in alias for future versions.
Yes, that does work. But personally, I'd prefer to make the ParseResult more robust and maybe simpy ignore the first line completely. Maybe the user has already set that env var for some other purpose?
EnvironmentVariables on ToolSettings are only for that child process and doesn't affect anything else for current script/user/system.
True, and it's your decision 🙂
I'm just wary of hardcoding the expected output.
Not much we can do unless structured output is provided by the tool.
As I said, you could ingore the first line in any case, no matter what it says :)
I think the only consistent way to ensure consistent known output is to set DOTNET_CLI_UI_LANGUAGE environment variable.
If it outputs an error or something unknown then it's risky to assume those are file paths to projects,
6.1 will have a basic slnx parser added with #4666, so ParseSolution alias is probably a better option.