During the Visual Studio installation include ASP .NET and the Microsoft Web Developer Tools
Create a new ASP .NET 5 project using Visual Studio
- File -> New -> Project
- From the templates select ASP .NET Web Application
- In the next step select one of the ASP .NET 5 templates
After clicking OK the new ASP .NET project is created. This will also download and initiate the new .NET toolchain.
.NET Version Manager – dnvm
Open a command prompt and type in dnvm. If the command dnvm is not found, you should create an ASP .NET project via Visual Studio first. This will download the necessary dependencies and add the command to the PATH variable. You can run this command from any directory you like.
The output should look like the following:
ASP .NET 5 applications can now target multiple „.NET frameworks“ e.g. a full .NET Framework which is fully compatible to your „old“ libraries and which will require a windows system to host the application (or you use Mono on Linux). If you for example use Entity Framework below version 7 you have to pick this one, because Entity Framework 6 depends on classes only found in a full .NET framework.
dnvm upgrade -r clr
Or you can use the new .NET Core framework, which can be run on multiple operating systems, but does e.g. not support Entity Framework 6 or namespaces like System.Drawing because it depends on Windows specific code.
dnvm upgrade -r coreclr
dnvm upgrade with the chosen parameter will then set the corresponding target framework and set PATH variable accordingly.
.NET Development Utility – dnu
If you now switch to the directory of the created ASP .NET 5 project and enter the command dnu you will the the following output.
With this tools you can check the dependencies of your project or build it by executing dnu build. This tools is great for figuring out problems during development.
If the command dnu can not be found, please make sure you ran dnvm upgrade first.
.NET Execution environment – dnx
If you enter the command dnx in the directory of the created ASP .NET 5 project you will see the following output.
By executing dnu build and then dnx web you are able to compile your new application and run it from command line. If the command dnx can not be found, please make sure you ran dnvm upgrade first.
KPM and commands found in other tutorials
ASP .NET 5 is a quite new technology and will be released in Q1 of 2016. KPM simply was the old name for some of the command line options that are now covered by dnu and dnx.
Why use command line tools in the first place
I am using Visual Studio to create my ASP .NET 5 application, so why do I need these command line tools?
Many tools build on top of the use of dnx. E.g. Entity Framework 7 uses dnx to provide command line options like scaffolding classes from an existing database etc. This will be covered in a later tutorial.
This article shows how to set up all the tools for developing ASP .NET 5 applications. In future blog articles we will also cover dependency management and setting up the toolchain for frontend development using NPM, Bower and Gulp.