22

I'm on a Japanese system and when I run MsBuild.exe to build a Visual Studio project, I get a mix of Japanese and English in the output:

C:\path\to\solution>C:\WINDOWS\Microsoft.NET\Framework\v3.5\msbuild.exe solution.sln
Microsoft (R) Build Engine Version 3.5.30729.1
[Microsoft .NET Framework, Version 2.0.50727.3082]
Copyright (C) Microsoft Corporation 2007. All rights reserved.

Build started 2/18/2010 1:03:04 PM.
Project "C:\path\to\solution.sln" on node 0 (default targets).
  Building solution configuration "Debug|Win32".
プロジェクト : warning PRJ0018: 以下の環境変数が見つかりませんでした:

How can I change it all back to English?

Vertexwahn
  • 7,709
  • 6
  • 64
  • 90
Laurent
  • 5,953
  • 14
  • 43
  • 59
  • I created this ticket at Visual Studio bug tracker so that we can choose MSBuild localization easier : https://developercommunity.visualstudio.com/content/problem/1271546/choose-msbuild-localization-with-an-option.html Please upvote it if you want he situation to improve. – Kiruahxh Nov 29 '20 at 10:03

9 Answers9

16

environment variable for eng: set VSLANG=1033

user3302274
  • 252
  • 2
  • 6
  • 1
    This worked for me (using CLion) and should be the accepted anwser as it does not modify the environment other than adding a variable (ie you do not need to delete files or change the global localization settings). @user3302274 should link to reference docs though. – geh Apr 03 '19 at 18:25
  • This worked for me running MSBuild in CMake on Windows 10. – Omegastick Apr 12 '19 at 14:19
  • 1
    This works for the cl.exe / link.exe command line tools of VS2019 - not sure yet if it helps with msbuild itself. – Martin Ba May 20 '20 at 14:18
  • 4
    does not work for me. msbuild.exe still in my own lang. – Softlion Sep 21 '20 at 05:14
  • 1
    need 2 commands: set VSLANG=1033 chcp 1252 – Fl0 Nov 27 '20 at 13:19
  • @Softlion , Hi. `VSLANG` doesn't seem to work with MSBuild, you can try `chcp` . For example, execute `chcp 437` , `chcp 850` or `chcp 1252` . Find more code page identifiers from [Microsoft Docs](https://learn.microsoft.com/en-gb/windows/win32/intl/code-page-identifiers) or [Wikipedia](https://en.wikipedia.org/wiki/Windows_code_page#List). – li ki Aug 26 '21 at 14:56
  • @Fl0 Thank you. `VSLANG` works for `CL.exe` and `chcp` works for MSBuild. – li ki Aug 26 '21 at 15:15
  • Well, when I only execute `chcp` but do not set `VSLANG=1033` , I will get output like `??????...` (should be `Generating code...` ) and `????...` (should be `Compiling...` ) from `CL.exe` . – li ki Aug 26 '21 at 15:15
15

Just solved the same problem with Russian:

I have removed following directories:

  • c:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\amd64\ru
  • c:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\amd64\ru-RU
Andrey
  • 927
  • 11
  • 12
  • This helped me, thanks. And I like that I don't have to change the settings for the whole OS. I just had to remove these: `c:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\ru` , `c:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\ru-RU` instead of the ones in amd64. – bla Mar 14 '19 at 08:10
  • For me with VS2019 it was the folder: `C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin` – Crigges Jun 13 '20 at 05:45
  • It helped me, however I would suggest renaming directory instead of removing it in case it will be needed in future. – solgar Aug 31 '21 at 21:23
  • 1
    For me the folder was in `c:\Program Files\dotnet\sdk\6.0.103\` – Petr R. Apr 03 '22 at 09:44
12

To change the language of MSBuild's output to English, simply call chcp 850 in the same console before actual call of MSBuild. It changes console's code page and MSBuild uses it.

Petr Silar
  • 137
  • 1
  • 3
  • 2
    This might work with Japanese, but it sorts no effect on Italian. (same codepage) Isn't there a more explicit, general, solution? – ZJR Jul 30 '13 at 20:53
  • It works for me, although some customized build event commands' output are still not in English (in Chinese)... but that's minor for me. – bruin Aug 10 '17 at 02:18
7

I was facing similar problem on machine WIN 8.1. It was installed in Czech and later English language pack was added. Result was that MsBuild started from console was in Czech language. I found in Region setting option Change system locale.. was in Czech. After switching to English output was in English.

Region language settings

Update for Windows 10

Region Windows 10

live2
  • 3,771
  • 2
  • 37
  • 46
Jaroslav Kubacek
  • 1,387
  • 18
  • 26
6

You need to remove the localization sub dirs (e.g. for italian: "1040", "it", "it_IT") from the following directories:

c:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\

c:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\amd64\

3

NOTE: After studying laurent's output a little more I do agree with Preet Sangha's answer. The output may come from the compiler not MSBuild. But if it was MSBuild that produced messages in wrong language, like in my case, I think my answer will work for you. So my answer really answers the title of this question.


I think your messages are coming from a Japanese Microsoft.Build.Tasks.resources.dll resource file. The Microsoft.Build.Tasks assembly contains build related tasks that are executed by MSBuild. These tasks output build related messages.

I think you have one or more Japanese .NET framework language packs. The solution is to uninstall all Japanese .NET framework language packs in Windows add remove programs dialog.


I had Norwegian MSBuild output. When I removed my Norwegian language pack I got standard English error messages. My Norwegian resource files where located in:

  • C:\Windows\Microsoft.NET\Framework\v4.0.30319\no
  • C:\Windows\Microsoft.NET\Framework\v4.0.30319\MOF\no
  • C:\Windows\Microsoft.NET\Framework\v4.0.30319\SQL\no
  • C:\Windows\Microsoft.NET\Framework\v4.0.30319\WPF\no
  • C:\Windows\Microsoft.NET\Framework64\v4.0.30319\no
  • C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MOF\no
  • C:\Windows\Microsoft.NET\Framework64\v4.0.30319\SQL\no
  • C:\Windows\Microsoft.NET\Framework64\v4.0.30319\WPF\no

These folders where removed after I uninstalled the Norwegian .NET framework language packs.


I think it is easier to search for information when you have standard English warning and error messages, so I would allways want to remove local language packs for developer tools.

Community
  • 1
  • 1
knut
  • 4,699
  • 4
  • 33
  • 43
3

I had a problem with logfiles being encoded with UTF-8 multiple times on a buildserver. This makes solutions like changing system language or deleting all the localizations for all the software undesirable. So i had to find an option to set system language in console.

Most of the time, you should be happy with using chcp 437 command at the begining of your .cmd file. This will switch to the official "hardware" codepage 437, which is included as part of your PC BIOS. It does, however, include characters for european languages, even if Microsoft calls it "OEM United States".

To exclude all the languages, except for readable english, you should use codepage 20127, which contains ASCII-only charachers. All "extended" characters will be rendered as ? (question marks). This is an extreme solution and only use it when nothing else works, as it will ruin your output if it happens to have any extended characters. I'm not sure it's a good idea, 'cause it's not and OEM charset, but it worked for me.

Ntrf
  • 73
  • 6
  • This solution works for me (tested on CMD and PowerShell) and is simple. It doesn't require changing the system's language, change any windows registry or files. The command `chcp 437` sets the code page to "United States" according to the documentation ([ss64.com](https://ss64.com/nt/chcp.html), [learn.microsoft.com](https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/chcp)) which out of the options is the most appropriated to set the language to English. – user7393973 Dec 04 '19 at 10:47
1

You need to remove language pack Jp and add English pack in Visual Studio Installer.

0

I suspect that message is coming from the compiler to your project, not the msbuild itself. But I don't know how to change it.

Preet Sangha
  • 64,563
  • 18
  • 145
  • 216