Multiplatform ASP .NET applications development

Since MS announced ASP .NET code was going to be released and uploaded to github everyone in development community got excited, but it was when MS confirmed its “multiplatform-ness”  when everyone realized the new world of possibilities coming. Multiplatform ASP .NET applications? really? that’s amazing!

This new MS approach added to Azure platform (one of the currently available biggest cloud computing platforms) is leading companies usually focused on MS technologies to collaborate more and more in projects hosted in Linux and Mac Os environments. Also companies which were not used to work with MS technologies are feeling attracted by the promise of being supported in their projects by a company like MS, always very focused on developers, while the big impediments that were previoulsy keeping away from it are being removed.

In Solid GEAR we are also very excited about these MS changes and in this blog entry we will introduce you to this new environment:

ASP .NET vNext

As previously said ASP.NET vNext is the new MS web stack, opensource, public, published through Github and multiplatform.

The main characteristics can be summarizing like that:

  • Totally modular: By default you have nothing. Modules are added based on needs
  • Faster development cycle
  • Seamless transition from on premises to cloud
  • Open source with contributions
  • Choose your editors and tools
  • Cross platforms
  • FAST

We can almost hear your from here: “Ok, but let me code!” Of course, We will let you know how we are currently doing to start a project from scratch using both Linux or Mac OS, just keep reading:

  • First step, install Sublime Text 3 (you can find it here:
  • Install Package Manager. To do that just navigate to:

View > Show Console (or ctrl+`)

And write the command below:

import urllib.request,os,hashlib; h = 'eb2297e1a458f27d836c04bb0cbaf282' + 'd0e7a3098092775ccb37ca9d6b2e4b7d'; pf = 'Package Control.sublime-package'; ipp =sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( '' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)
  • Launch Package Control:

Cmd + Shift + P (Mac Os) or Ctrl + Shift + P (Linux)

And write “Install Package”. The option showing “Package Control: Install Package” has been highlighted. Using this feature we will install to useful plugins that will help us in our developments:

  • Kulture: adds features like F5 to run.
  • OmniSharp: enables C# related features (Intellisense, colors…)
  • Install Yeoman ( It basically helps us to kickstart new projects.
sudo npm install -g yo
  • Install aspnet generator for yo:
sudo npm install -g generator-aspnet (this generator has been created by Kulture authors)

At this moment we are ready to create a new blank web application: ooooohhh. Just launch yeoman command with aspnet generator:

yo aspnet

And select “Web Application”. You will see:

Your project is now created, you can use the following commands to get going
    kpm restore
    kpm build
    k run for console projects
    k kestrel or k web for web projects

K Runtime Environment

In order to run these commands we need to install the “K Runtime Environment” or KRE. KRE is the command line environment that will build and run projects using new project.json project file.

Installation of the KRE is handled by the “K Version Manager” (KVM). This is a simple app that can install multiple versions of the KRE side by side, and allow you to easily switch between them.

  • Just run:
curl | sh && source ~/.k/kvm/ && kvm upgrade

This command will:

  • download and save it in ~/.k/kvm/
  • add the command to run on every login to bash/zsh.
  • will then be run via the source command. This adds the kvm command to the current shell.
  • run kvm upgrade. This will download the latest KRE package, extract it to .kre/packages and add the bin folder to your path.

You can also install kvm following the instructions provided in or

  • Execute
sudo kpm restore

from project folder will download and link all pending references detailed in project.json

We are almost done, just run:

k kestrel

And it will run web server. How? Where? Well, Kestrel is a multiplatform web server specially developed for ASP.NET vNext. If you take a look to the project.json file, you will see under “commands” sections and entry named “kestrel”. This is the command run by KRE. As you can see, by default it is:

"kestrel": "Microsoft.AspNet.Hosting --server Kestrel --server.urls http://localhost:5004"

What means it runs the web application under localhost:5004. Navigate there and That’s it!

Brief instroduction to New Web Application ASP.NET 5

The main config files you have to deal with are:

  • project.json: webapp dependencies (entity Framework, diagnostics, iis, security.cookies and so on)
  • config.json: settings like connection strings

Everything has been migrated to json, but if you love pain, you could still continue using xml if you like.

The startup class has now been moved to Startup.cs file:

  • Startup.cs:  It reads config.json and also environment parameters if needed. In this class is where the different services or modules are added (entity framework, identity or even MVC). By default there is nothing.



This minimize the resources needed in a deployment and also increase scalability. It eases the pain of updating a new version in old .NET web applications.

Sublime Text 3 Kulture Plugin

Also, as a little gift, find a few steps to work with kulture under Sublime Text 3

  • Save Project As… to create .sublime-project file and define workspace. It is needed for kulture to find project.json
  • Cmd + Shift + P (or Ctrl + Shift + P)  > Run  K Commands (or F5) > kvm restore, k kestrel
  • If fails:
    • Go to project.json and remove all /* */ lines
    • “No such file or directory” in source command: go to “/Users/<user>/Library/Application Support/Sublime Text 3/Packages/Kulture” and change “source” by “source ~/.k/kvm/”

Now, it is your turn! What are you wating to create a fantastic web application using ASP .NET vNext?

Leave a Comment

¿Necesitas una estimación?

Calcula ahora