我安装了 .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.
Run Code Online (Sandbox Code Playgroud)
dotnet tool install在没有Visual Studio的情况下如何使用?
我在全新安装 win10/.netcore (没有 Visual Studio)时遇到了同样的问题 - 似乎默认情况NuGet.config下没有默认设置包源(至少对我来说)。
为了解决这个问题,我在以下位置添加了以下packageSource配置%AppData%\NuGet\
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
Run Code Online (Sandbox Code Playgroud)
编辑:此外,您可能需要下载NuGet.exe到工具文件夹,并将其添加到您的PATH以使用 nuget。
| 归档时间: |
|
| 查看次数: |
1687 次 |
| 最近记录: |