Solving Missing Default DNX Issues
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
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 https://www.nuget.org/api/v2. 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 ru...get.org/api/v2.:String) , Run timeException + FullyQualifiedErrorId : There are no runtimes matching the name dnx-clr-win-x86 on feed http s://www.nuget.org/api/v2.
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:
After the command competes you can run the following:
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-x126.96.36.199-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-x188.8.131.52-beta7\bin to process
PATH Adding C:\Users\yourusername\.dnx\runtimes\dnx-clr-win-x184.108.40.206-beta7\bin to user PATH
Setting alias 'default' to 'dnx-clr-win-x220.127.116.11-beta7'
After running the commands you will find that the dnx command now functions as expected.