dotnet tool install -g 无法解析
dotnet tool install -g unable to resolve
我安装了 .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 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。