How I got ASP.NET vNext running on Mac OS X


Modern Slim MacBook Pro on White BackgroundThe next version of ASP.NET MVC (ASP.NET vNext) will run on a “cloud-optimized” platform which will work on Linux and Mac OS X with Mono, too. Here is how I got it running on my MacBook.

Important Note: ASP.NET vNext is still work in progress and it may not work as intended. Please do not use it in production!

Required Mono Version and Basics of K Runtime

First I installed Mono from source, because the current stable version (Mono 3.4.0) is not sufficient to run ASP.NET vNext applications. This will change when the next stable version of Mono is released. Then I installed the K Version Manager (KVM). KVM is used to manage different versions of the K Runtime the ASP.NET vNext runs on. Graeme Christie and Simon Timms blogged about how to install Mono from source and the KVM.

How you can use KVM to manage different versions of the K Runtime on your machine? Type kvm to see a list of available commands. The most important commands are:

  • kvm upgrade: Installs the latest KRE (K Runtime Environment).
  • kvm list: Lists the installed runtime environments.
  • kvm use: Switches to a specific kRE version.

A Simple “Hello, World” Program

Type kvm upgrade to install the latest KRE. Then create a file somewhere on your disk with the name “project.json” and the following content:

  "dependencies": {
    "System.Console": ""
  "configurations": {
    "net45": {},
    "k10": {}

Create another file in the same directory with the name “Program.cs” and the following C# program as content:

using System;
public class Program
    public static void Main()
        Console.WriteLine("Hello, World!");

The first file is the project file. It contains the dependencies and describes the runtime configurations. The dependencies are NuGet packages. You can use the K Package Manager (KPM) to work with the packages. Type kpm help or kpm to get an overview of the kpm commands. Restore the packages by typing kpm restore now and run the program with k run.

When I was experimenting with ASP.NET vNext I ran into some errors:

  • System.AggregateException: —> System.IO.IOException: Too many open files“. Solution: increase the maxfiles limit of your system:
> launchctl limit maxfiles 16384 32768
  • Could not load type ‘System.Reflection.Internal.MemoryMappedFileBlock’ from assembly ‘System.Reflection.Metadata, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’.System.Reflection.Internal.Metadata” Solution: Check the Mono version with mono --version and make sure that the correct version of Mono can be found in your PATH variable.

ASP.NET MVC Project Generator for Yeoman

An MVC application consists of controllers, views, model and configuration files and maybe other files needed by the program. A scaffolding tool can create new projects from a template or a generator. One of those tools is Yeoman and Hassakarn C. wrote an ASP.NET MVC Project Generator for Yeoman which can create projects for ASP.NET vNext.

If you want to use Yeoman you’ll have to install Node.js. Follow the instructions on its homepage. It comes with NPM, the Node Package Manager, which you can use to install Yeoman and the ASP.NET MVC Project Generator:

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

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

> yo aspnet

Then you can select the type of application you want to create.

Screenshot ASP.NET MVC Project Generator for Yeoman

If you create a console application, you can run your program with k run. It is the same application we built before without Yeoman.

k run runs the program by invoking its entry point, a static method called Main. An MVC program doesn’t have such a method. When you open the “project.json” file of the MVC application you’ll find a section called commands:

  "commands": {
    "web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5001",
    "kestrel": "Microsoft.AspNet.Hosting --server Kestrel"

This section defines commands which you can use instead of run when you invoke k. As you can see there are two commands defined: web and kestrel. web invokes a server used for self-hosted ASP.NET programs. It doesn’t work on OS X yet. But you can use the alternative Kestrel server which is a libuv-based HTTP server for .NET.

You can run your MVC application with Kestrel with this command:

> k kestrel

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

If you try to start the application with k run you’ll get an error with the following message: “<appname> does not contain a static ‘Main’ method suitable for an entry point“. So make sure that you type the right command for your type of application.

Creating Nancy Projects with Yeoman

Inspired by the Yeoman generator for ASP.NET MVC Jonathan Channon created a generator for the Nancy framework. Nancy is a lightweight framework for building HTTP based services on .NET and Mono. You can install the generator via npm:

> npm install -g generator-nancy

For creating a Nancy project type the following into your terminal:

> yo nancy

The generated project contains a simple Nancy module which is hosted on Kestrel with the OWIN interface. You can start the Nancy application with the k command:

> k kestrel

Using Sublime Text 3 for Working With ASP.NET vNext Projects

One of my favorite text editors is Sublime Text. It can be extended by plugins and Sourabh Shirhatti started working on an extension for ASP.NET vNext, called “Kulture”. He demonstrates the extension in a YouTube video.

You will need Sublime Text 3 which is still in beta and the Package Manager for Sublime Text 3 if you want to try it. Then press Cmd-Shift-P which opens the Command Palette and select “Package Control: Install Package”. Then select “Kulture” from the package list.

The extension configures the Sublime Text Build System for builds with the K Runtime. When you opened an ASP.NET vNext project from the project directory you can build it by pressing Cmd-B. If there are compilation errors you can cycle through them with F4. And with Cmd-Shift-P you can select “Run K Commands” and start one of the commands defined in the project.json file.


With ASP.NET vNext Microsoft tries to build ASP.NET on a new platform which can be run on UNIX like operating systems like Linux or Mac OS X. In this article I showed you how you can install it and how you can run a simple “Hello, world!” program. I introduced you to the Yeoman scaffolding tool and two generators, one for creating MVC apps and one for creating Nancy apps. Finally I showed you an extension for the popular Sublime Text editor.

It’s interesting to see new ideas coming from the community. I’m curious how the new tools will evolve and how creating applications on ASP.NET vNext and Mono will look like in a few months.

4,371 thoughts on “How I got ASP.NET vNext running on Mac OS X

  1. Simon Timms

    I was quite interested to see the yoman generator. That certainly streamlines the whole process.

    I wanted to mention that in the last couple of days mono 3.6 has been released. It should fix most, if not all, of the issues to allow the running on vNext on *nix. Thus building from source is no longer a requirement.

  2. Satyam Kumar

    While running MVC project i am getting the errors like

    Unable to resolve dependency Microsoft.AspNet.Server.IIS 1.0.0-beta1

    Unable to resolve dependency Microsoft.AspNet.Mvc 6.0.0-beta1
    Unable to resolve dependency Microsoft.AspNet.Hosting 1.0.0-beta1
    Unable to resolve dependency Microsoft.AspNet.Security.Cookies 1.0.0-beta1
    Unable to resolve dependency Microsoft.AspNet.Server.WebListener 1.0.0-beta1
    Unable to resolve dependency Microsoft.AspNet.StaticFiles 1.0.0-beta1
    Unable to resolve dependency Kestrel 1.0.0-beta1

    error CS0234: The type or namespace name ‘AspNet’ does not exist in the namespace ‘Microsoft’ (are you missing an assembly reference?)

    please tell me where i am doing it wrong ???

  3. Greece and Italy have lately began to let identical-sex couples to register as partners, when Ireland and Finland now permit them to marry.
    About_Yourself 20 year-old Horse Using Instructor or Instructor Kristopher Jaimes from Angus, has lots of interests including boating, sex partner paris and tea tasting. In recent years has made a vacation to Kasbah of Algiers.

  4. Geraldgek

    The difficulty is that many investors don’t know which expenses are reasonable and which expenses should be avoided. Adding to this stew is that there is a large measure out between the flush and the quieten and middle classes that matter something that is a deteriorate of pelf at rhyme steady to be a unrealistic arrangement at another.

    For the sake of pattern, it will again restore b succeed suspect for someone earning $50,000 a year without le cours du bitcoin live a big-hearted portfolio to leave out an investment advisor altogether, unless there are some behavioral advantages that lead to better outcomes or the convenience is simply quality it, as it is to varied people, as opposed to opting for the sake of a disciplinary problem of well-selected, low-cost clue funds.

  5. Woodrowroady

    For the duration of warning, it will ordinarily overstate sagacity in requital for someone earning $50,000 a year without cours du bitcoin btc en euros a large portfolio to waive an investment advisor wholly, unless there are some behavioral advantages that assume command of to bigger outcomes or the convenience is really good it, as it is to assorted people, preferably opting repayment for a handful of well-selected, low-cost sign funds.

  6. Jamesfop

    What could be considered more of a stylish fact, putting, is how average details – uniquely ‘guileless facts’ – is chic, as le site informel sur le cours bitcoin illustrated during the outcome of websites such as the Defender Datablog and, the same of my white-haired internet time-wasters, Information is Beautiful. Interestingly, what we enjoy also seen throughout the model insufficient years is the command driving disrespectful the generous data agenda, for the sake benchmark finished with the flyer of the Uncommitted Statistics White Paper.

  7. WalterTield

    One look at the quotation blueprint has fed fears a major carbonation is forming and could be about to burst. But le cours du bitcoin a discuter the fresh cost nullify follows multiple warnings through the model 12 months that the practical currency was nearing a peak.

  8. Answer ability Italy number one online business reach at 2015, Jordan and Nike shoes for cheap Italian Republic to get market improvement but also established quite balance from social bookmarking or situation needs, as soon as time period in a row, in turn to build specialized designation “” 2015 European company sociable need. Orthopedic shoes for girls got some sort of present to 2014, then 2013 Nike air Jordan 19.5 makes high outcome. Fashion sneakers for cheap to customer service but also tax info, bodied societal responsibilities, transparency, and application caliber therapy inside the various clues have gotten high marks. China jordans collection zone, running manager KicksOkok, declared: “as being a respected fitness trademark inch Italy, we both involved with the business local community as part of their blame. Whether to cut down Eco foot print, ones event out of healthy and balanced lifestyl, to life ability in helping each shaky basketball game user, well we are dedicated gotten each lasting progression of the brand.

  9. wh0cd47949 [url=]xenical prices[/url] [url=]kamagra 100mg[/url] [url=]buy mobic[/url]

  10. wh0cd119448 [url=]albuterol inhaler prescription[/url] [url=]buy yasmin birth control pills[/url]

  11. Любому креативному профессионалу есть что продемонстрировать многолюдной аудитории. Это мастер-классы по уходу за детьми, урок пения или немецкого, психологический тренинг, юридическая рекомендация. Видеотрансляция интересного ролика привлечет аудиторию и позволит заработать достойный заработок.
    За что пользователи охотно отдадут деньги? За допуск к оригинальной онлайн трансляции, право задавать вопросы ведущему. Пользуются повышенным спросом профессиональные сюжеты с презентацией полезных навыков, обучающие курсы. Создание и показ сюжета поручают профессионалам – тогда успех гарантирован!
    двухкамерная видеосъемка