The source at nuget.org is unreachable?

若如初见. 提交于 2021-01-28 11:54:02

问题


I'm trying to install SignalR in my C# project, but all I get when running install-package Microsoft.AspNet.SignalR is:

The source at nuget.org [https://www.nuget.org/api/v2/] is unreachable. Falling back to NuGet Local Cache(...) At line:1 char:1 + install-package Microsoft.AspNet.SignalR + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand

This error was posted to Stack Overflow a few times, but no solution has worked for me. I've tried:

  • Starting a new project
  • Removing and adding all of my nuget sources
  • Trying nuget with projects where it worked
  • Reinstalling nuget
  • Reinstalling Visual Studio

Nothing worked. I can reach nuget.org just fine from my browser.

I would appreciate some help.


回答1:


Try using the UI. For me the UI works fine but the Package Manager needs to be told explicitly where the source is. Try the command:

install-package Microsoft.AspNet.SignalR -Source nuget.org




回答2:


To work around this, you can run nuget install Microsoft.AspNet from the command line in your solution root. Then when you try again in the Package Manager it will find the cached copy and succeed:

.nuget\NuGet.exe install Microsoft.AspNet.SignalR.Client -OutputDirectory packages


来源:https://stackoverflow.com/questions/26969234/the-source-at-nuget-org-is-unreachable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!