Setting up DNX and running a web app from the command line

Update 4/3/2015

I’ve updated globally to Bower 1.4

npm update -g bower

DNX, or the .NET Execution Environment has the bits that bootstrap and run an ASP.NET web application. We can use dnvm, the .NET Version Manager to set up DNX for us. I usually go right to the source on GitHub found here
Note we are using the latest nightly builds here which is why we’ll use the -u (unstable) flag in dnvm commands. I’m doing this on Windows 8.1 Pro x64.



Download the zip and extract it. I put it in my C:\ drive.

Navigate to the src directory and type dnvm.

You should see this menu.


Now type dnvm setup. Files are installed into $userprofile%\.dnx\bin
Also PATH and DNX_HOME enviornment variables are setup for you.



Now naviagate to the new bin directory and run
dnvm install latest -u -arch X86 -r CLR -a default
This downloads and installs the latest package


Run dnvm list

you should see a runtime in the list now.

Active Version           Runtime Architecture Location                     Alias
------ -------           ------- ------------ --------                     -----
      1.0.0-beta5-11400 clr     x86          C:\Users\Glenn\.dnx\runtimes
      1.0.0-beta5-11413 clr     x86          C:\Users\Glenn\.dnx\runtimes
      1.0.0-beta5-11427 clr     x86          C:\Users\Glenn\.dnx\runtimes
      1.0.0-beta5-11466 clr     x64          C:\Users\Glenn\.dnx\runtimes
 *    1.0.0-beta5-11466 clr     x86          C:\Users\Glenn\.dnx\runtimes default

I usually add the path to this runtime in my PATH envirnment variable so that I can run k (dnx) commands from my project folder. Note some of this is now done for you when you run upgrade.
I found the path to the runtime bin directory as shown here and added this to beginning of my PATH variable.



Now close this command prompt and open a new command prompt window.

Periodically you can run

dnvm upgrade -u

to keep your DNX up to date. Remember to update your path to the new runtime bin directory.

A new command which allows dnvm to update it’s own files is

dnvm update-self

Next I’m going to grab an ASP.NET app from GitHub that I know should work with DNX and the nightly ASP.NET builds. You can find it here.




I have git installed so I can just clone it into my projects folder.



You can also download the zip file and extract if you don’t use git.

Now cd into the NeoSample-ASPNET5\test\NeoSample.Tests folder and run

dnu restore

now run

dnx . test

You should see the Example tests execute.



One test should succeed and one should fail.

Now cd to


and run

dnu restore

now run

dnx . web

In a web brower enter http://localhost:5000/

You should see the Home page of NeoSample.


Go ahead and register yourself in the app. The app is using the inMemory provider with the ApplicationDbContextModelSnapshot model.

You can use the command

dnx . ef

when in src\NeoSample and see the Entity Framework menu


I’m using the Brackets text editor, just point it to your src\NeoSample or test\NeoSample directory and code away.

There is a dark Visual Studio extension for Brackets to make you feel right at home.