Xamarin Studio is a great Mono IDE (Integrated Development Environment) in OS X area. At the time of writing this article, the version of Xamarin studio and mono framework I use are :
Xamarin Studio
Version 4.2.1 (build 1)
Runtime:
Mono 3.2.5 ((no/964e8f0)
GTK+ 2.24.20 theme: Raleigh
GTK# (2.12.0.0)
Package version: 302050000
Xamarin Studio includes with ASP.NET MVC 2 and 3 project template. While trying to create ASP.NET MVC 3 project, I got couples of errors such as authorization access etc. The good news is even though there is no project template for ASP.NET MVC 4, we still can convert our ASP.NET MVC 3 to run as ASP.NET MVC 4. The steps are :
Create an ASP.NET MVC 3 project either with aspx or razor view engine
Run the project via Xamarin studio menu (Run > Run With > Mono Soft Debugger for ASP.NET. While running the project, we may got an error message :
System.UnauthorizedAccessException
Access to the path "/Library/Frameworks/Mono.framework/Versions/3.2.5/etc/mono/registry" is denied.
Description: HTTP 500.Error processing request.
Details: Non-web exception. Exception origin (name of application or object): mscorlib.
Exception stack trace:
......
To solve the error, run the following command in terminal :
As the error message, we need to make our ASP.NET Web Pages version to 2.0.0.0 in web.config. So just open web.config and change webpages:Version to 2.0.0.0. as follow :
<addkey="webpages:Version"value="2.0.0.0"></add>
Change assembly version declared in root web.config and /View/web.config of the following
assembly
from
to
System.Web.WebPages.Razor
1.0.0.0
2.0.0.0
System.Web.Mvc
3.0.0.0
4.0.0.0
Now re-run the project again via Xamarin Studio and our project should run well as expected.