ASP.NET 5 Developed and Running on Mac OS X

ASP.NET 5 Developed and Running on Mac OS X

At its annual developer conference, Build, Microsoft announced quite a few surprises this year, but perhaps most surprising was its new, cross-platform version of Visual Studio Code. Code is a lightweight, modern code editor in the same vein as Sublime, Atom, etc. Code is free and available for Linux, Mac OS X and Windows.

While Code is missing a few of our developers’ favorite tools, it is now possible to develop, deploy and run an ASP.NET Web application entirely on Mac OS X with the help of Mono and an open source .NET Core. This would have been considered absurd just a few years ago. Open source, cross platform, free? We’re entering strange and exciting times with this new Microsoft.

So, how do we get started?

Install Homebrew and run the following commands to install ASP.NET 5:


brew tap aspnet/dnx
brew install dnvm
source dnvm.sh

You should now see the following:

Example 1

Install Code, and then download the sample project from Microsoft's GitHub account. Open Code, and then open the sample project folder:

Example 2

Open Program.cs and edit the message as you prefer:

Example 3

Now all that's left is to navigate to the directory of the project you just edited and run the project:

Example 4

This is all a little Hello World-ish admittedly, but a Hello World developed in an OS X version of Visual Studio and running in ASP.NET 5 on a Mac. And what's wrong with a little excitement over Hello World?