Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting up MVC 4 (Razor) with MonoDevelop

I'm trying desperatly to setup a MVC 4 (in the worst caes 3) with Razor on Monodevelop. I'm sitting on a Mac OS X machine, with Mono 2.11.4.

It seems to not have all the assemblies required. System.Web.Helper for instance, doesn't seem to be found. And MonoDevelop can only find System.Web.Mvc version 3 (With NET framework 4.5 selected) or version 2 (with NET Framework 4.0 selected). Does anyone know how to get MVC 4 with Razor to work?

like image 885
Robin Heggelund Hansen Avatar asked Sep 23 '12 07:09

Robin Heggelund Hansen


2 Answers

(Razor pages worked with Mono, in theory, with version 2.10.x series, but you had to bundle Microsoft's assemblies with it into your Linux box.)

Since Mono 2.11.1, these assemblies are now bundled by default in Mono, because Microsoft open sourced Razor recently (on March 2012). So: you're using the correct version of Mono.

The catch is that, as explained in this blogpost, MVC4 depends on the async ASP.NET API stack, which is not ready yet in Mono. So yes you can now use Razor with Mono without the need to deploy MS assemblies from Windows, but, you need to stick with MVC3, not 4, for now.

(Copy-pasted my answer from this other stackoverflow question and tweaked it a bit.)

like image 107
knocte Avatar answered Sep 27 '22 21:09

knocte


I modified the VS2010 MVC4 Project Template to run out-of-the-zipfile in Xamarin Studio/MonoDevelop on Mac & Linux: http://www.cafe-encounter.net/p1319/run-asp-net-mvc4-on-mono-monodevelop-on-mac-the-c-template-project.

Update: I've done a MVC4 on .Net 4.5 template with notes at http://www.cafe-encounter.net/p1510/asp-net-mvc4-net-framework-version-4-5-c-razor-template-for-mono-on-mac-and-linux including link to github.

like image 37
Chris F Carroll Avatar answered Sep 27 '22 21:09

Chris F Carroll