As I’m not a .NET expert (yet), I had significant issues getting ASP.NET MVC (Razor) to work on Xamarin / Mac. Now I don’t want to rant about flashbacks of when I worked a lot more in MS space, particularly DLL hell, but this is DLL hell and it truly sucks.
Simply put; Xamarin (and I assume Monodevelop, but i’m not sure about that) installs a MVC 3 System.Web.Mvc.dll, but it’s missing the System.Web.WebPages.dll.
In the created Web.config it’s referring to that as Version=220.127.116.11. There are tutorials online to fix it having NuGet manage your Xamarin assemblies (partially); following those, at this moment, you’ll get a nice System.Web.WebPages which is for MVC 5 and won’t work because of missing references in System.Web.
What you need is another version of System.Web.WebPages; you actually need version 2 instead of the version 1 indicated in the generated Web.config.
To fix that, download nuget.exe to your mac and run, somewhere;
mono nuget.exe install Microsoft.AspNet.WebPages -Version 2.0.30506
change, in your Web.config, the referencing key;
<add key=“webpages:Version“ value=“18.104.22.168“ />
and Edit your references;
remove System.Web.Helper & System.Web.WebPages (both are red as they cannot be found) and replace them by pointing to DLLs nuget downloaded for you above. Screenshot here.
Now everything works fine.