gpt4 book ai didi

.net-core - dotnet tool install -g 无法解析

转载 作者:行者123 更新时间:2023-12-05 01:59:13 24 4
gpt4 key购买 nike

我安装了 .NET 5 SDK,但没有安装 Visual Studio。

每当我尝试执行工具安装时,例如 dotnet tool install -g csharprepl,它总是会导致:

error NU1100: Unable to resolve 'csharprepl (>= 0.0.0)' for 'net5.0'.
error NU1100: Unable to resolve 'csharprepl (>= 0.0.0)' for 'net5.0/any'.
The tool package could not be restored.
Tool 'csharprepl' failed to install. This failure may have been caused by:

* You are attempting to install a preview release and did not use the --version option to specify the version.
* A package by this name was found, but it was not a .NET tool.
* The required NuGet feed cannot be accessed, perhaps because of an Internet connection problem.
* You mistyped the name of the tool.

如何在没有 Visual Studio 的情况下使用 dotnet tool install

最佳答案

我在全新安装 win10/.netcore(没有 Visual Studio)时遇到了同样的问题 - 似乎默认的 NuGet.config 没有默认设置包源(在至少对我来说)。

为了解决这个问题,我在 %AppData%\NuGet\ 中添加了以下 packageSource 配置

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>

编辑:此外,您可能需要将 NuGet.exe 下载到工具文件夹,并将其添加到您的 PATH 以使用 nuget .

关于.net-core - dotnet tool install -g 无法解析,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67998134/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com