How to change MSBuild error message language?
Asked Answered
G

9

24

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?

Glasgo answered 18/2, 2010 at 4:7 Comment(1)
I created this ticket at Visual Studio bug tracker so that we can choose MSBuild localization easier : developercommunity.visualstudio.com/content/problem/1271546/… Please upvote it if you want he situation to improve.Kerstinkerwin
M
18

environment variable for eng: set VSLANG=1033

Micahmicawber answered 30/1, 2018 at 19:46 Comment(8)
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). @Micahmicawber should link to reference docs though.Surefire
This worked for me running MSBuild in CMake on Windows 10.Leddy
This works for the cl.exe / link.exe command line tools of VS2019 - not sure yet if it helps with msbuild itself.Acquaintance
does not work for me. msbuild.exe still in my own lang.Divalent
need 2 commands: set VSLANG=1033 chcp 1252Recognizee
@Divalent , 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 or Wikipedia.Hoye
@Recognizee Thank you. VSLANG works for CL.exe and chcp works for MSBuild.Hoye
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 .Hoye
N
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
Navelwort answered 28/6, 2017 at 18:40 Comment(4)
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.Tormentil
For me with VS2019 it was the folder: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\BinTurpentine
It helped me, however I would suggest renaming directory instead of removing it in case it will be needed in future.Sleuth
For me the folder was in `c:\Program Files\dotnet\sdk\6.0.103`Strauss
H
14

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.

Holmquist answered 20/8, 2012 at 13:38 Comment(2)
This might work with Japanese, but it sorts no effect on Italian. (same codepage) Isn't there a more explicit, general, solution?Kolyma
It works for me, although some customized build event commands' output are still not in English (in Chinese)... but that's minor for me.Kakapo
D
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

Dachi answered 11/6, 2015 at 21:33 Comment(2)
This will not work on Windows Home edition if anyone unfortunate enough to be using that comes across this answer.Beforetime
I don't want to change the windows languageDivalent
O
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\

Oligarchy answered 1/9, 2018 at 5:7 Comment(0)
M
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.

Megrims answered 11/8, 2012 at 12:3 Comment(0)
C
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.

Corsetti answered 15/12, 2017 at 9:4 Comment(1)
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, learn.microsoft.com) which out of the options is the most appropriated to set the language to English.Foushee
K
1

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

Kaif answered 2/6, 2022 at 6:4 Comment(0)
K
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.

Kraul answered 18/2, 2010 at 4:30 Comment(2)
depends on the language c/C++ = cl.exe, c# = csc.exe, vb = vbc.exeKraul
msbuild.exe command line is in my language. so it comes from msbuild.exeDivalent

© 2022 - 2024 — McMap. All rights reserved.