Home » Android » android – Error MSB4185: "System.Globalization.CultureInfo" has not been enabled for execution

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

Posted by: admin June 15, 2020 Leave a comment


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.

How to&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:


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.



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.


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.