Solving Missing Default DNX Issues

By SharkBoy SharkBoy


You may of come across articles that demonstrate using the Microsoft .NET Execution Environment (dnx) command line tool but when you try to run dnx commands you get an error message such as:

'dnx' is not recognized as an internal or external command, operable program or batch file.

You may have tried use the .NET Version Manager (dnvm) to set the default runtime version as shown in other Microsoft articles by runing the following command:
dnvm use default

Resulting in the following error:

Cannot find dnx-clr-win-x86.default, do you need to run 'dnvm install default'?
At C:\Users\yourusername\.dnx\bin\dnvm.ps1:1561 char:9
+         throw "Cannot find $runtimeFullName, do you need to run '$Com ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (Cannot find dnx...stall default'?:String) [], Run
    + FullyQualifiedErrorId : Cannot find dnx-clr-win-x86.default, do you need to run 'dnvm instal
   l default'?

You follow the directions in the error message and run the following command:

dnvm install default
This results in the following error:There are no runtimes matching the name dnx-clr-win-x86 on feed At C:\Users\yourusername\.dnx\bin\dnvm.ps1:597 char:9 + throw "There are no runtimes matching the name $RuntimeId on ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OperationStopped: (There are no [], Run timeException + FullyQualifiedErrorId : There are no runtimes matching the name dnx-clr-win-x86 on feed http s://

The Fix

Your issue is that you have not created the default alias for the .NET Runtime environment. The setup did not create this for you. To solve this issue first make sure your .NET Version Manager is up to dat. You can do this by running the following command:
dnvm update-self

After the command competes you can run the following:
dnvm upgrade
This command will first attempt to download the latest version of the runtime. After this is successful it will update the PATH environmental variables to include the bin directory for the new DNX version downloaded. Next dnvm will automatically create the default alias and point it to the new DNX version.

The following is sample command line output for dnx Beta 7.

C:\Users\yourusername>dnvm upgrade
Determining latest version
'dnx-clr-win-x86.1.0.0-beta7' is already installed in C:\Users\yourusername\.dnx\runtimes\dnx-clr-win-x86.1 .0.0-beta7.
Adding C:\Users\yourusername\.dnx\runtimes\dnx-clr-win-x86.1.0.0-beta7\bin to process
PATH Adding C:\Users\yourusername\.dnx\runtimes\dnx-clr-win-x86.1.0.0-beta7\bin to user PATH
Setting alias 'default' to 'dnx-clr-win-x86.1.0.0-beta7'

After running the commands you will find that the dnx command now functions as expected.

© Copyright 2007 - 2016 Ciliberti Enterprises Corporation. All Rights reserved Reproduction in whole or in part without written permission is prohibited. Version 5.2 updated 1/13/2017