I'm using the System.CodeDom
features to compile code at run time and I wonder if I could specify a compiler parameter or other workaround to display the compiler errors in English language instead of using the system's default language.
However, in the MSDN documentation I can't find anything related to the displayed language:
When I want to display compiler errors in a specific language under Visual Studio IDE when building a project what I do is change the current culture, then I tried to set the culture in my application and also inside the file that I'm compiling from my application, but firstly that does not take effect, and secondly I prefer to avoid possible tricks like this, because possibly it will require automated code generation (imports, references, and code when calling CodeDomProvider
compiler):
Thread.CurrentThread.CurrentCulture = New CultureInfo("en-Us") Thread.CurrentThread.CurrentUICulture = New CultureInfo("en-Us")
You probably should use CompilerParameters.CompilerOptions property. If you open link you may find example there. You need to change preferreduilang parameter. To set output language to English use "/preferreduilang:en-US" option. Keep in mind that it would not work for languages which are not installed in your system.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With