Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error MSB4185: "System.Globalization.CultureInfo" has not been enabled for execution

When trying to build in MonoDevelop with Mono for Android I get this error. According to the debug it is not located in my code so im left clueless. Any idea?

Error MSB4185: The function "CurrentUICulture" on type "System.Globalization.CultureInfo" has not been enabled for execution. (MSB4185)

like image 899
user1439648 Avatar asked Jun 06 '12 11:06

user1439648


3 Answers

I own MSBuild (and this code). It's an error originating in the file microsoft.csharp.targets, as the error message probably says. In there is a property function:

$([System.Globalization.CultureInfo]::CurrentUICulture.Name)

What the error means is that it thinks that this function isn't in MSBuild's "safe list". These are selected functions that have no side effects. (If you want to use any function, you must have an environment variable MSBUILDENABLEALLPROPERTYFUNCTIONS=1).

I really don't know why this would appear unless somehow you're using the 4.5 microsoft.csharp.targets with the 4.0 microsoft.build.dll (which didn't have it in the safe list). I haven't received reports of this except in connection with Monodevelop.

Excuse my naivety, but I'm assuming Monodevelop is using the Microsoft .NET Framework with the Microsoft MSBuild and not a reimplementation of that.

Dan

like image 193
dan Avatar answered Nov 01 '22 23:11

dan


The working solution for me is this:

Open a CMD and run this command on it: setx MSBUILDENABLEALLPROPERTYFUNCTIONS 1

Another solution I think is available is installing Mono Runtime and set it as your default CLR runtime from Tools -> Options -> .NET Runtimes.

like image 30
Ebrahim Byagowi Avatar answered Nov 02 '22 00:11

Ebrahim Byagowi


After uninstalling .NET Framework 4.5 RC from my Windows 7 machine, this error disappeared. Of course make sure you have valid .NET runtime after you uninstall 4.5.

like image 1
Dominique Avatar answered Nov 02 '22 00:11

Dominique