【发布时间】:2021-01-03 18:16:03
【问题描述】:
我无法在 dotnet 中安装 AWS Lambda 工具:
$ dotnet tool install -g Amazon.Lambda.Tools
error NU1100: Unable to resolve 'amazon.lambda.tools (>= 0.0.0)' for '.NETCoreApp,Version=v3.1'.
error NU1100: Unable to resolve 'amazon.lambda.tools (>= 0.0.0)' for '.NETCoreApp,Version=v3.1/any'.
The tool package could not be restored.
Tool 'amazon.lambda.tools' 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 Core tool.
The required NuGet feed cannot be accessed, perhaps because of an Internet connection problem.
You mistyped the name of the tool.
For more reasons, including package naming enforcement, visit https://aka.ms/failure-installing-tool
尝试安装 Lambda 模板时的类似结果:
$ dotnet new -i Amazon.Lambda.Templates
Determining projects to restore...
C:\Users\Me\.templateengine\dotnetcli\v3.1.404\scratch\restore.csproj :
error NU1100: Unable to resolve 'Amazon.Lambda.Templates (>= 0.0.0)' for '.NETCoreApp,Version=v1.0'.
我使用的是 Windows 10,使用 bash shell 和 DOS 命令行的结果相同。
.NET Core v3.1 似乎安装正常:
$ dotnet --version
3.1.404
我尝试卸载 .NET Core SDK v3.1 并重复使用 .NET Core SDK v2.1 和 .NET SDK 5.0,结果相同。我试过禁用杀毒软件,没有效果。
尝试安装特定版本号时结果相同:
$ dotnet tool install --global Amazon.Lambda.Tools --version 5.0.0
error NU1100: Unable to resolve 'amazon.lambda.tools (>= 5.0.0)' for '.NETCoreApp,Version=v3.1'.
我从https://www.nuget.org/packages/Amazon.Lambda.Tools/5.0.0 手动下载了包。下载的包文件名为amazon.lambda.tools.5.0.0.nupkg。然后我尝试安装这个包的本地副本,但它失败了(虽然我不确定我是否正确使用了这个命令):
$ dotnet tool install -g Amazon.Lambda.Tools --add-source ./amazon.lambda.tools.5.0.0.nupkg
C:\Program Files\dotnet\sdk\3.1.404\NuGet.targets(128,5): error : The local source 'C:\Users\Me\Desktop\amazon.lambda.tools.5.0.0.nupkg' doesn't exist. (C:\Users\Me\AppData\Local\Temp\g23ky0jg.io4\restore.csproj)
The tool package could not be restored.
【问题讨论】:
-
你在
%appdata%\NuGet\NuGet.Config有什么疯狂的事情吗? -
谢谢 Philip,不,那个文件没有什么异常,只是:
<?xml version="1.0" encoding="utf-8"?> <configuration> <activePackageSource> <add key="NuGet official package source" value="https://nuget.org/api/v2/" /> </activePackageSource> </configuration>
标签: amazon-web-services .net-core aws-lambda