Tag Archives: asp.net mvc

Code, Projects

ASP.NET MVC 5 Template for Xamarin Studio

ASP.NET MVC 5 Template for Xamarin Studio

Recently the latest version of Xamarin Studio has been released, along with Mono 3.4. And honestly, no one can deny that cross platform .NET development just keeps on getting better and better. I still see a great future for especially Mono if the open source community and the people at Xamarin manage to keep their current pace of improvements. #kudos++

Although with every update of both Xamarin and Mono the bar is set higher, some fields of interest seem to be lacking to get updated. Clearly the mobile platforms, like iOS, Android and Windows Phone seem to get all the attention. But the web platform seems to lose focus in the Xamarin/Mono tagteam, especially ASP.NET.

For example, the native template for ASP.NET is still set to version 3. Which was the non-MyGet version, if you remember. And that means b*tchy to update and cumbersome to update to recent versions. However, it is still possible to actually run and debug new ASP.NET MVC sites on Mono.

To this end, I’ve created a simple and clean setup for a Xamarin project that allows you to run an ASP.NET MVC 5.1 site on Mac OSX. In short:

Fork it on GitHub

Grab a fresh copy from the git repo and you’ll get:

  • A clean ASP.NET MVC 5 application with RAZOR support
  • Can be run entirely from Xamarin Studio on Mac OSX
  • Can be updated and extended through NuGet
  • It just works…

Known Issues

Do note that an Empty ASP.NET MVC 5 project created in Visual Studio won’t run by default in Xamarin. You have to plumb a bit here and there. If you’re curious on what you need to do to make things blend on Xamarin Studio on Mac, take a look at the changes I’ve made in the repo.

Tip: Want to reproduce it yourself? All required changes to run ASP.NET MVC 5 on Mac are neatly documented as seperate commits.

To summarize these changes, the current limitations for a clean setup seems to be:

  • App relative paths don’t work, e.g. using tildes like ~/assets/style.css
  • The view’s web.config has teh disabled
  • Mono currently supports .NET 4.5, not 4.5.1
  • routes.LowerCaseUrls isn’t supported (yet)
  • System.Web.Entity reference isn’t supported (yet)