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

回眸只為那壹抹淺笑 提交于 2019-12-22 04:19:14

问题


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)


回答1:


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




回答2:


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.




回答3:


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.



来源:https://stackoverflow.com/questions/10913484/error-msb4185-system-globalization-cultureinfo-has-not-been-enabled-for-execu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!