Cmd 优先级:安装在 2 个位置时如何使用正确的 dotnet.exe? [英] Cmd precedence: How to use correct dotnet.exe when installed in 2 locations?

查看:21
本文介绍了Cmd 优先级:安装在 2 个位置时如何使用正确的 dotnet.exe?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不久前,我手动安装了 dotnet core 2.1.2 SDK,将其解压缩到我的 %AppData% 文件夹中,并将其位置添加到 PATH 环境变量中.这很有效,我可以通过 cmd 调用 dotnet 命令,并且 VS Code 选择了正确的位置.

a while ago I installed the dotnet core 2.1.2 SDK manually, by unzipping it into my %AppData% folder, and adding its location to the PATH environment variable. This worked well, I could invoke the dotnet commands via cmd, and VS Code picked up the correct location.

最近,我安装了 Visual Studio 2017,它安装了 net core 1.1 SDK 到 %ProgramFiles%dotnet.尽管此特定路径未在 PATH 变量中注册,但现在似乎默认使用此文件夹中的 dotnet.exe.

Recently, I installed Visual Studio 2017, which installed the net core 1.1 SDK to %ProgramFiles%dotnet. Even though this particular path isn't registered in the PATH variable, it seems the dotnet.exe from this folder is now used by default.

或者换句话说,当我打开 cmd.exe 并输入where dotnet"时,我看到两个位置:

Or in other words, when I open cmd.exe and type "where dotnet", I see two locations:

  1. %ProgramFiles%dotnetdotnet.exe(Vs2017 安装的 1.1 SDK)
  2. %AppData%....dotnetdotnet.exe - 即我手动解压的 2.1.2 SDK

当我运行dotnet --version"时,我看到 1.1.0 - 所以默认的 dotnet 命令似乎与 %ProgramFiles% 文件夹中的旧 1.1 版本相关联.

When i run "dotnet --version", I see 1.1.0 - so the default dotnet command seems to be associated with the old 1.1 version from the %ProgramFiles% folder.

我如何更改那里的优先级 - 例如如何将 dotnet 命令与我的自定义文件夹关联?

How can I change the precedence there - e.g. how can I have the dotnet command be associated with my custom folder instead?

我应该注意到我使用的是非管理员 Windows 帐户.我自己无法更改 %ProgramFiles% 文件夹中的任何内容(因此无法将较新的 SDK 复制到该文件夹​​,或删除/更改旧的).

I should note I am running on a non-admin windows account. I cannot change anything in the %ProgramFiles% folder myself (so cannot copy over the newer SDK to that folder, or delete/change the old one).

谢谢

推荐答案

尝试更改 %PATH% 环境变量,使其仅包含 .NET 文件夹之一.

Try to change the %PATH% environment variable so it includes only one of the .NET folders.

这篇关于Cmd 优先级:安装在 2 个位置时如何使用正确的 dotnet.exe?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆