Cmd优先级:在2个位置安装时如何使用正确的dotnet.exe?

编程入门 行业动态 更新时间:2024-10-25 22:33:38
本文介绍了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:

  • %ProgramFiles%\dotnet\ \dotnet.exe(由Vs2017安装的1.1 SDK)
  • %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?

    本文发布于:2023-11-10 09:26:59,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1574998.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:优先级   如何使用   正确   位置   Cmd

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!