dnx command not found in Developer command prompt for VS2015

匿名 (未验证) 提交于 2019-12-03 02:44:02

问题:

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?

回答1:

In my case dnvm use default -p didn't work. But this helped:

dnvm upgrade dnu restore 


回答2:

Run dnvm use default -p to persist the changes to the environment variable.



回答3:

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.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!