This blog post will guide you to create a new vNext based Hello World console application. Since Microsoft has not released any development tooling around .Net vNext, we will resort to command line tools and notepad.
Step 1 - Download and install GitHub for Windows
GitHub for Windows is an excellent tool for Windows based developers, providing an easy to use UI to synch, branch and clone repositories. It can be downloaded from https://windows.github.com/
After installation, you can login to your existing GitHub account, or if you don't have one, you can create a new GitHub account. On the left side, it displays your GitHub account and the organizations you are part of.
Step 2 - Download and install K Version Manager (KVM)
KVM is required to perform following two main tasks:
It uses NuGet.exe to download the available versions of runtime.
You can read more about KVM at https://github.com/aspnet/Home/wiki/version-manager
To install and setup KVM, navigate to https://github.com/aspnet/Home and click Clone in Desktop button. It will copy the repository to your local machine (by default at %USERPROFILE%\Documents\GitHub\Home). Once it is cloned, it will be displayed in GitHub application.
Right click the repository and select Open a shell here from the context menu
On the shell, type kvmsetup.cmd It will copy kvm files to "%USERPROFILE%\.kre\" folder and will add this "%USERPROFILE%\.kre\bin" to your path, with this we can run kvm.cmd from anywhere in command line.
You can type kvm help to learn more about its available commands.
Step 3 - Download KRuntime (KRE)
KRE is required to bootstrap and run the ASP.NET vNext application. You can read more about KRE at https://github.com/aspnet/KRuntime
Type kvm install 0.1-alpha-build-0446 command to download KRE.
This command will download and copy KRE at %USERPROFILE%\.kre\packages\KRE-svr50-x86.0.1-alpha-build-0446 location and will also add "C:\Users\admin\.kre\packages\KRE-svr50-x86.0.1-alpha-build-0446\bin" folder to process path (means the life time of command line shell)
Step 4 - Create Console Application repository in your GitHub account
Select your account on left side of the GitHub application, and click + create button on the top. It will prompt for new public repository Name and Description (Unlimited number of public repositories can be created freely on GitHub)
Type SamplevNextConsoleApp for the Name of Repository, and "A Sample vNext Console Application to explore vNext features" for the Description, then click Create button to create a public repository. Local copy of repository will be in %USERPROFILE%\Documents\GitHub\SamplevNextConsoleApp folder.
Step 5 - Create Program.cs file
This file is same as Program.cs file created by Visual Studio for Console Applications. Open "%USERPROFILE%\Documents\GitHub\SamplevNextConsoleApp" folder and create Program.cs file in it. Double click the file to open it in installed version of Visual Studio.
Create Program class and Main function in it as an entry point of application and in Main function type Console.WriteLine("Hello World"). Final code will look like this:
public class Program
public static void Main()
Step 6 - Create Project.json file
Runtime looks for project.json file in the project directory to compile and run the application. It contains metadata, dependencies and supported commands.
Create new Project.json file in project directory and type the following json in it:
Dependencies section lists all the dependencies of the application. At minimum it defines name and version of the dependency and doesn't specify any other information about the location of the package. Runtime loaders determines the location of the package, which could be a NuGet package, source code on local disk or a compiled package.
Configurations section specify the runtime for which it needs to build application. The above project.json will build for net45 (Desktop) and k10 (Core CLR) runtime.
For more details, you can see https://github.com/aspnet/Home/wiki/Project.json-file
Step 7 - Run the awesome application
On the command line shell, navigate to project directory and type, kpm restore
It will download System.Console package from NuGet because it is defined as dependency in project.json
And finally type k run command to execute the console application and you will see "Hello world" output.