Sunday, 30 November 2014

Get Started with Asp.net5 vNext on Windows

Note: This post is outdated and not applied to current version of Asp.net DNX version. 

This is my first time experience with Asp.net 5. I’m excited about the new open source .Net CLR. The promise from Microsoft is to use new technology without affecting the current environment of .Net is quite impressive. So we’re going to talk about it how it works. This post will be a startup for people who wants to start with Asp.net 5 application. Just to get impressed what did they do? How did they do it? It will come with my another post so keep an eye.
What is next
As the title says, The post is about the Asp.net vNext on windows so though it’s open source but in this post I’ll cover only windows platform.
First of very all we need to know the terminology. Here are few:
  • K
  • KVM
  • KPM
These are the terms or more of commands we’re going to use throughout this blogpost.
Run the following script via powershell. Make sure you are running the poweshell with Admin privileges.
powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/aspnet/Home/master/kvminstall.ps1'))"

In the original documentation it has @ at the start but you need to remove it to make it run.

Now run the command prompt and try running kpm command. This will not say the command doesn’t exist but it’ll show you the help menu of kvm command.

Now try running KVM List on the command prompt it won’t show a result if you’re running it first time. Don’t worry run following command:

KVM UPGRAGE

It’ll install the latest KRE and K platform on you machine. Still you’re far away to get the latest open source .Net CLR. ;) Download the latest samples for Asp.net 5 sample application or clone it via GitHub. https://github.com/aspnet/Home

Run the command prompt and go to the application directory of downloaded samples. and Run the command “K Run” or “K Web” depends on what kinda of application you have in sample application collection.

I promise to have separate dedicated blog on explanation of K platform. but this time we’re just going to experience the free world of open source .Net. No Installation but just developer experience.

Run following command in the sample application via command prompt:

KPM RESTORE

It’ll restore the required Runtime or call it .Net CLR for you application. Now just a step left to take.

K Run

K Web

Depends on your application if it has Main or if It’s a web application. You’ll see the console messages or just a mesasge “Started” after launching the command.

If it’s a console application you’ll see console message on the same command prompt otherwise if it’s a web it’ll just say “Started”. Now go to “http://localhost:5001” to access the hosted application. This is a default port and it’s configurable.

This is the first step to start with we’re gonna rest of the world in my upcoming posts.