Just installed Visual Studio 2015 RC and when I open a Developer command prompt for VS2015
and type in dnx
it says:
'dnx' is not recognized as an internal or external command, operable program or batch file.
I discovered, after two days mind you, that if I type dnvm use default
it adds a path to my environment variable so that the command dnx
can be found. This persists only for as long as the current window is open.
Why isn't the default .net 5 framework automatically added to the PATH environment variable for me?
In my case dnvm use default -p
didn't work. But this helped:
dnvm upgrade dnu restore
Run dnvm use default -p
to persist the changes to the environment variable.
Whilst the behaviour is odd, what you are seeing is by design. The idea is to allow you to run multiple versions of ASP.NET 5 simultaneously in different command prompt sessions and to install a new version of ASP.NET 5 without breaking the operation of existing sites targeted at a different version.
The reason for the behaviour you are seeing with dnvm use default
is that dnvm use default
sets the default PATH for just that command prompt, where as dnvm use default -p
sets the default PATH for the user.
To run through the whole process and see what's going on, first do:
dnvm upgrade
This gets the most up to date version of ASP.NET 5 and sets it as the default for that command prompt session.
Then you can list out all the versions of ASP.NET 5 installed on your machine as follows:
dnvm list
You can then set one of the items in that list as the default with e.g. (NB: the actual version may be different depending on when you view this answer):
dnvm use 1.0.0-rc1-update1 -r clr -arch x64 -p
The -p
on the end means 'persist' and that is the setting that will then persist the default you just selected to both the process (session) PATH and also the user PATH variable. Persisting to the user PATH means the default is then available in all command prompts.
If you leave off the -p
then you can select a version just for use in that command prompt session.
After that you should be able to use dnx
as expected.