ASP.NET vNext on OSX

ASP.NET vNext on OSX

Its time to be happy, for Microsoft lovers ☺. Microsoft is moving some components to open source. They have recently released a preview on next generation of ASP.NET platform.

The Future of .NET is moving to a different level; they are restructuring the whole .NET components. There is so much cool stuff happening in Microsoft web application side, and they came up with some thing called ASP.NET vNext.

Good News - The next version of ASP.NET will be completely open source :D :D

In a nutshell the following list will be the future of ASP.NET vNEXT

  • Open Source
  • Modular
  • Feature - no-compile (After development refresh-and-get the result :D like python and ruby)
  • Full power of Roslyn and the .NET Framework
  • Side-by-side hosting with different .NET versions

What do think? I just love the future of .NET

Now its great chance to get explore and can contribute too. I got inspired with ASP.NET vNEXT from Scott Hanselman post. I know more than reading it you will love to listen and visualize all the changes. So check the tech event conducted by Daniel Roth is a Senior Program Manager on the ASP.NET team.

Building Mono

I thought of running ASP.NET vNext on my Mac. To run .NET on Mac you need to install Mono. Mono is an open source implementation of Microsoft’s .NET Framework based on the ECMA standards for C# and the Common Language Runtime. The best way to install mano is to grab the source code, build and install it. I set my prefix in the autogen step to be in the same directory as my current version of mono.

git clone
cd mono ./ --prefix=/Library/Frameworks/Mono.framework/Versions/ 3.10.1
sudo make install

To compile this source code I struggled a lot with some building errors. But google helped me to successfully build and install Mono framework. Hope you will install it too Cheers!

Installing KVM and the K Runtime Environment

Installing KVM is super simple. I installed KVM using homebrew. Install homebrew if you don’t already have it After installing homebrew run the following command to install the runtime environment to run side-by-side ASP.NET web applications.

brew tap aspnet/k
brew install kvm

Creating ASP.NET MVC Template

The following command will show the ASP.NET vNext runtime, which runs on Mono CLR. Here I have brand new build version alpha 4 (Figure 1) .

kvm list
Figure 1 - kvm list

For the mac development experience, Microsoft has created a Yeomen generator. Yeomen is a web’s scaffolding tool for modern web apps, which helps to kick start new projects ☺.

ASP.NET vNext MVC Project Generator for Yeoman

If you want to use Yeoman, you’ll have to install Node.js. If you have not installed Node.js follow the instruction on their site and install. Node Package Manager (NPM) comes with node.js installation, which you can use to install Yeoman and ASP.NET generator. Run the following command in your terminal and successfully install Yeoman and aspnet generator.

npm install -g yo
npm install -g generator-aspnet

You can create a new project for the K Runtime by running :

yo aspnet
Figure 2 - yeoman aspnet

I know, I should look at your faces when you’ll see the Console Application option :D (Figure 2). If you create a console application, you can run your program with k run. ASP.NET vNext can be fully self-hosted. If you want to fire up a console app you can do that easily and do some cool applications.

I will create a MVC application. See the Figure 3, it will create the app and download all the Nuget Packages, which is hosted on my-get.

Figure 3 - Nuget packages

That’s it. Now we are ready to host the side-by-side server using K Runtime. When you open the “project.json” file of the MVC application you’ll find a section called commands (Figure 4)

Figure 4 - project.json

This section defines commands, which you can use to start up the server on K Runtime. As you can see there are two commands defined: web and kestrel. web invokes a server used for self-hosted ASP.NET programs. It works only in windows and doesn’t work on OS X yet. But you can use the alternative Kestrel server.

k kestrel

The default port is 5004. If you navigate your browser to http://localhost:5004 you should see the default welcome page of ASP.NET vNext (Figure 5).

Figure 5 - ASP.NET vNext MVC Application

Hopefully this post has demonstrated a brief of cross platform ASP.NET vNext. There are still rough edges in cross platform. But don’t worry in near future there will be stable version ☺.

I’m waiting!!…