Bug 5597 - Error MSB4185 when using MSBuild from MD on Windows 8
Summary: Error MSB4185 when using MSBuild from MD on Windows 8
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Project Model ()
Version: Trunk
Hardware: PC Windows
: High normal
Target Milestone: ---
Assignee: Lluis Sanchez
Depends on:
Reported: 2012-06-09 18:37 UTC by Mikayla Hutchinson [MSFT]
Modified: 2012-06-20 13:24 UTC (History)
7 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Mikayla Hutchinson [MSFT] 2012-06-09 18:37:38 UTC
When building projects with the MSBuild build engine on Windows 8, MonoDevelop gets the following error from MSBuild: 
Error MSB4185: The function "CurrentUICulture" on type "System.Globalization.CultureInfo" has not been enabled for execution.
Comment 1 Atsushi Eno 2012-06-10 15:53:06 UTC
This occurs on Windows 7 too.
Comment 2 Mikayla Hutchinson [MSFT] 2012-06-11 19:54:00 UTC
Do you have .NET 4.7 / VS11 installed on Win7?
Comment 3 Atsushi Eno 2012-06-12 01:02:07 UTC
Yes (VS2012RC), that might be the difference from ordinal Win7.
Comment 4 Atsushi Eno 2012-06-14 02:44:43 UTC
My wild guess is that .NET 4.5's MSBuild.exe sets CurrentUICulture internally (we don't do that in MD) which requires SecurityPermissionAttribute(ControlThread = true), and we somehow launch it with insufficient privilege.
Comment 5 Michal 2012-06-15 10:46:08 UTC
I am having the same problem on Windows 7. I tried uninstalling VS12 and re-installing monodevelop but the error remains.
Comment 6 Dominique Louis 2012-06-18 10:37:16 UTC
@Michal,  Uninstalling VS2012 does not uninstall .NET 4.5 (which replaced .NET 4.0). You will need to uninstall .NET 4.5 and then reinstall the .NET 4.0 run-time for MonoDevelop to work again. Well until a fix is released to add .NET 4.5's CurrentUICulture issue.
Comment 7 Michal 2012-06-18 10:40:40 UTC
Thanks this worked for me.
Comment 8 Jonathan Pryor 2012-06-18 14:58:20 UTC
As per the comments to this stackoverflow.com answer:


The MSB4185 error appears to be a .NET 4.5 bug, which may or may not be fixed quickly. The workaround is to migrate to using the Microsoft.Build.dll embedding API instead of using the Microsoft.Build.Engine.dll API (which is currently used).
Comment 9 Mikayla Hutchinson [MSFT] 2012-06-18 15:05:48 UTC
Well, we already have one builder exe per MSBuild version, so we can make the 4.0 one use the new hosting API. However, this is complicated by the fact that Mono doesn't not have an implementation of the new hosting API.

Maybe we can add an additional builder exe that's only used when the target runtime is MS .NET 4.0+?
Comment 10 Lluis Sanchez 2012-06-20 13:24:42 UTC
Fixed in master.