TL;DR : Is it possible with Visual Studio 2015's MSBuild to change the messages language of MSBuild on the command line using a direct approach instead of messing with system settings? And how?
We have a question from "way back then" that is essentially a duplicate, but IMHO the answers show the question needs to be refined.
I need this to work for VS2015 and up, so I'm not overly concerned with older versions.
So, here are some factoids:
- Googling doesn't show up any MSBuild command line option that would change the language of the output messages.
- Using MSBuild from the command line on a german system will give me german error messages.
- Using an english visual studio on the same system to invoke MSBuild will make MSBuild (the actual
MSBuild.exe
as confirmed from process explorer process tree) output english messages on a german system!- This implies that
devenv.exe
is able to driveMSBuild.exe
to use a different languange.
- This implies that
To wit:
c:\temp\TestApp>msbuild TestApp.sln /t:rebuild /v:normal
Microsoft (R)-Buildmodul, Version 14.0.25420.1
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.
Die Projekte in dieser Projektmappe werden nacheinander erstellt. Um eine parallele Erstellung zu ermöglichen, müssen Sie den Schalter "/m"
hinzufügen.
Der Buildvorgang wurde am 18.10.2016 11:06:33 gestartet.
Projekt "c:\temp\TestApp\TestApp.sln" auf Knoten "1", rebuild Ziel(e).
ValidateSolutionConfiguration:
Die Projektmappenkonfiguration "Debug|X64" wird erstellt.
Das Projekt "c:\temp\TestApp\TestApp.sln" (1) erstellt "c:\temp\TestApp\TestApp\TestApp.csproj" (2) auf Knoten "1", Rebuild Ziel(e).
CoreClean:
Die Datei "C:\temp\TestApp\TestApp\bin\x64\Debug\TestApp.exe.config" wird gelöscht.
...
GenerateBindingRedirects:
Keine vorgeschlagenen BindingRedirect-Einträge von ResolveAssemblyReferences.
GenerateTargetFrameworkMonikerAttribute:
Das Ziel "GenerateTargetFrameworkMonikerAttribute" wird übersprungen, da alle Ausgabedateien hinsichtlich der Eingabedateien aktuell sind.
CoreCompile:
...
and from devenv
:
c:\temp\TestApp>devenv.com /Rebuild "Debug|x64" TestApp.sln
Microsoft Visual Studio 2015 Version 14.0.25420.1.
Copyright (C) Microsoft Corp. All rights reserved.
1>------ Rebuild All started: Project: TestApp, Configuration: Debug x64 ------
1>Build started 18.10.2016 11:10:27.
1>CoreClean:
1> Deleting file "C:\temp\TestApp\TestApp\bin\x64\Debug\TestApp.exe.config".
...
1>CoreCompile:
...
Clearly, devenv drives the output here, but the actual msbuild messages are the same, and devenv will invoke MSBuild.exe as an actual child process.
I have checked with Process explorer: The invoked MSBuild.exe doesn't have any command line parameters indicating the project in use nor is there any apparent environment variable set. So it seems devenv is "telling" MSBBuild to use english as the language by some other means.
Side note MSBuild is invoked from VS like this: C:\Program Files (x86)\MSBuild\14.0\bin\MSBuild.exe /nologo /nodemode:1 /nodeReuse:true
So, how do I tell MSBuild.exe
that it should english output? I'm fine with any wrapper approach or maybe some powershell magic (though that seems unlikely), but I'm not fine with having to rely on machine/user locale settings for this.
Also, I've found an MSDN thread where the answer was -- 8 years ago -- that VS can do this because it sets the UI culture - but if devenv can do this, for it's invoked msbuild.exe I'd have though I probably can too: I just have no clue how.
/LCID id
or/L id
is the way in msdn – Proximal/LCID
switch you link to seems to be fordevenv.exe
-- this question is aboutmsbuild.exe
outside of visual studio. (The again maybe you meant that by ".. a comment here for someone search for devenv ..") – Attenweiler