ASP.NET MVC5 – what you need to know to start coding on OSX

I spent a bit of time today to try and get MVC5 up and running on my MAC.

This Yeoman generator is a good starting point

https://www.npmjs.com/package/generator-aspnetmvc

Unfortunately the template is a bit out of date, and took me a while to get it to work.

The use of ~ to reference the root does not seem to be supported in mono and there are a few newer version of Microsoft.AspNet.WebPages and Microsoft.AspNet.Mvc

Here is the final result with a working version of MVC5 on OSX

https://github.com/smnbss/YeomanMVC5

MVC5

ASP.NET vNext – what you need to know to start coding on OSX

ASP.NET vNext on OSX is, as expected, a lot of manual work to get it up and running.
I’m so used to open Visual Studio, create a new project and press F5 that this new Open Source approach is slightly more work than I wish it was.

Here is a list of useful links:
Install Brew
>ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”

Install ASP.NET on OSX
Ensure you have the latest version of mono installed (Mono JIT compiler version 3.12.0)
>brew unlink mono
>brew install mono
>mono -V
Install aspnet
>brew tap aspnet/k
>brew install kvm
>source kvm.sh
>kvm upgrade

Add source kvm.sh to your ~/.bash_profile so that you do not have to source kvm every time you open a new terminal

Install Yeoman generators for ASP.NET 5
>npm install -g yo generator-aspnet

Install one of the OmniSharp IDE for Cross platform .NET development
My choice is sublime-text3
>brew install caskroom/cask/brew-cask
>brew cleanup && brew cask cleanup
>brew cask install sublime-text3

Register sublime on your terminal
>ln -s “/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl” /usr/local/bin/sublime

Build a new App
>yo aspnet
Manually select Web App and type YoWebApp as name
>cd YoWebApp
>kpm restore
>kpm build
>sublime .
>k kestrel

out

Read what Scott Hanselman (@shanselman) has got to say about .NET as Open Source

Announcing .NET 2015 – .NET as Open Source, .NET on Mac and Linux, and Visual Studio Community

Looks like a lot of effort to me, but I’m sure I’ll get used to it in the end.
I’m hugely in favour of the Mono runtime, and I’ve been playing with it since 2011 so I’m super super excited to see what is coming up from Microsoft 🙂

Good Luck! 🙂