icsharpcode / SharpDevelop

#develop (short for SharpDevelop) is a free IDE for .NET programming languages.
2.09k stars 772 forks source link

The language name 'en-US' is invalid. (CS2038) #753

Open mcdon-ron opened 8 years ago

mcdon-ron commented 8 years ago

Using SharpDevelop 4.4.2.9749 on Windows Vista x64. On the initial build or when rebuilding the solution I get the following warning for each project.

The language name 'en-US' is invalid. (CS2038)

But the warning does not occur when I build the solution using MsBuild from the command line. This stackoverflow post shows other users discussing the same issue, but no solution.

The solution with projects that have produce the warning: LanguageNameInvalid.zip includes builds.bat for launching the command line build

The Logs from building using MsBuild from the command line: BuildLogs.zip

mrward commented 8 years ago

I am unable to reproduce this on Windows 7 with SharpDevelop 4.4.2. Looking at the StackOverflow post it seems to be specific to Windows Vista. You could try turning the build verbosity to Diagnostic (Tools - Options - General - Projects and solutions) and compare the MSBuild output.

mcdon-ron commented 8 years ago

there's a difference in the call to the csc task for the AssemblyInfo.cs attaching the project with the msbuild log, and the sharpdevelop diagnostic build log LanguageNameInvalid.zip

from the msbuild command line build msbuild-log.txt

Task "Csc"
  C:\Windows\Microsoft.NET\Framework\v4.0.30319\Csc.exe /noconfig /checked+ /nowarn:1701,1702 /nostdlib+ /platform:AnyCPU /warn:4 /define:DEBUG;TRACE /highentropyva- /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /debug+ /debug:Full /optimize- /out:obj\Debug\LNI_20.dll /target:library /utf8output MyClass.cs Properties\AssemblyInfo.cs
  Microsoft (R) Visual C# Compiler version 4.0.30319.34209

  for Microsoft (R) .NET Framework 4.5
  Copyright (C) Microsoft Corporation. All rights reserved.

Done executing task "Csc".

and from SharpDevelop with "Build Verbosity: Diagnostic" sd-verbose-log.txt

  Task "Csc"
    C:\Windows\Microsoft.NET\Framework\v4.0.30319\Csc.exe /noconfig /checked+ /nowarn:1701,1702,2008 /nostdlib+ /platform:AnyCPU /define:DEBUG;TRACE /errorendlocation /preferreduilang:en-US /highentropyva- /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /debug+ /debug:Full /optimize- /out:obj\Debug\LNI_20.dll /target:library /utf8output MyClass.cs Properties\AssemblyInfo.cs
    Microsoft (R) Visual C# Compiler version 4.0.30319.34209

    for Microsoft (R) .NET Framework 4.5
    Copyright (C) Microsoft Corporation. All rights reserved.

Warning CS2038: The language name 'en-US' is invalid.
    CSC : warning CS2038: The language name 'en-US' is invalid.
  Done executing task "Csc".
mrward commented 8 years ago

Looking at the parameters being passed to Csc you can see two different parameters when the solution is compiled using SharpDevelop:

/errorendlocation /preferreduilang:en-US

The preferreduilang parameter seems to be causing the problem. I see that parameter set in SharpDevelop 4 and 5 on Windows 7, but that seems to cause problems for Windows Vista.

The preferreduilang flag is automatically set to true by MSBuild if the BuildingInsideVisualStudio property is set to true which is what SharpDevelop does. So I suspect this problem also affects Visual Studio. You can also reproduce this from the command line if you pass /p:BuildingInsideVisualStudio=true to MSBuild. When SharpDevelop does not set BuildingInsideVisualStudio to true then the preferreduilang is not used.

I suspect SharpDevelop will not be changed to fix this problem on Windows Vista. I believe the BuildingInsideVisualStudio flag is set to speed up the build. You could try building a local copy of SharpDevelop with a line commented out in the MSBuildEngine if you want to fix the warning.

mcdon-ron commented 8 years ago

I just confirmed that adding /p:BuildingInsideVisualStudio=true to my msbuild command line reproduces the issue. It seems the core of the issue is with csc.exe and the parameter preferreduilang:en-US on Windows Vista. I'm not familiar enough with the preferreduilang parameter to speculate on why it would be causing the warning.

awr-reb commented 7 years ago

I've had this same warning from the first time I used SharpDevelop. Error Msg: The language name 'en-US' is invalid. (CS2038). After reading the comment above from 'mrward' I decided to go to Tools, Options, General, UI Language and change the language from English to a different language. I rebuilt the solution and the error went away. I changed the language back to English and the error did not return. In the IDE there should be a choice for US and England. The current language selection only shows the GB flag which somewhere in the code is probably using 'en-GB' which is throwing the error since the computer has software installed with the settings 'en-US'. There is a difference between the various countries that speak English (eg. Australia, South Africa, Canada, USA, etc.). This is why you can choose what type of English when choosing the spell checker, hence dictionary.

Edit: I'm back in SharpDevelop IDE and the error has returned. Seems if the language is not English the problem goes away. There are two choices for Spanish- Spain and Mexico. There should be a US choice for English available in the gui.