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

查看:174
本文介绍了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%\dotnet\ \dotnet.exe(由Vs2017安装的1.1 SDK)

  2. %AppData%.... \dotnet\dotnet.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复制到该文件夹​​,也无法删除/更改旧的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天全站免登陆