-
Notifications
You must be signed in to change notification settings - Fork 6k
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
[Breaking change]: MSBuild will now Respect DOTNET_CLI_UI_LANGUAGE
#35348
Comments
The change doc should make clear that this applies to No need to mention the change wave--that's an emergency thing; if someone needs it we want them to file a bug about the problem so we can fix it. (We should still put it in the change wave docs though)
Instead of the operating system's language, right? |
That all sounds right to me! |
@ghogen Is it on your radar to update https://learn.microsoft.com/en-us/visualstudio/msbuild/change-waves?view=vs-2022? |
The person who makes the PR normally does this; I asked nagilson to take care of it. |
(That list comes from https://github.com/dotnet/msbuild/blob/main/documentation/wiki/ChangeWaves.md, though it's a little out-of-date.) |
@gewarren That's a very good question and is surprising to me. Thanks for bringing it up. How did you set the language? Is the OS language set anywhere? |
@nagilson My OS language is set to English and OS region is United States. This is how I set the CLI language:
|
Hm. I need to take some time to look into this and get back to you. There was some logic in-place for this but it was not comprehensive and never accounted for the environment variable, so off-hand I don't know why it might work in some cases on older versions |
I tried using the same version of MSBuild but it didn't work for me: I discovered it seems this is 'fixed' by the change I made in the SDK in 7.0.300 we worked on here: #34250 @Forgind can you think of any command where the SDK would exit before MSBuild finishes? I didn't see any commands like that, for build it waits until the msbuild proc is finished. But if there are any such commands, there would be a race condition where sometimes MSBuild versions older than the one that went into 8.0 preview 5 would still use english. This fixes that. What this change does do is make MSBuild pick up the language by itself or regardless of the .NET SDK that it's in. So the real change is if you invoke MSBuild without that fix in the 7.0.300 SDK or outside of the .NET SDK, it will still respect the environment variable. |
Description
Before. if
DOTNET_CLI_UI_LANGUAGE
was set, if you ran a command such asdotnet build
, the messages coming from the .NET SDK code would be in the language set toDOTNET_CLI_UI_LANGUAGE
(example:ja
for Japanese). BUT the messages from MSBuild code would still be in english.Version
.NET 8 Preview 5
Previous behavior
MSBuild output would always be in english and use its own encoding for english regardless of
DOTNET_CLI_UI_LANGUAGE
.New behavior
MSBuild output will be in UTF8 encoding now if
DOTNET_CLI_UI_LANGUAGE
is set on Windows and UTF 8 is supported. For all OS's, MSBuild will use the language set byDOTNET_CLI_UI_LANGUAGE
instead of english.Type of breaking change
Reason for change
Example before:

Example after:

You can see with the current change, messages like BUILD SUCCEEDED or BUILD FAILED with information will now be in the same language as the .NET SDK. This makes sense, as customers likely don't want a mix of different languages for some of their dotnet output if they said for it to be one particular language.
Recommended action
If you would like to keep the old behavior, unset
DOTNET_CLI_UI_LANGUAGE
viaset DOTNET_CLI_UI_LANGUAGE=
in the CMD or a respective command for your shell to change environment variables. You may also disable the MSBuild Change Wave of Wave17_8 if you want to keep the .NET SDK using the language but not msbuild: https://learn.microsoft.com/en-us/visualstudio/msbuild/change-waves?view=vs-2022Note that this should be added to the change waves document listed above.
Feature area
Other (please put exact area in description textbox)
Affected APIs
Feature Area: MSBuild (& .NET SDK)
Associated WorkItem - 97020
The text was updated successfully, but these errors were encountered: