Visual Studio 2017 Professional- Unable to find package at source

旧城冷巷雨未停 提交于 2019-12-08 07:52:46

问题


I was trying to add package through nuget package manager=> package manager console and from Manage Nuget packages from solution directly. I am trying to install Newtonsoft.Json from Package Manager Like this Install-Package Newtonsoft.Json but unable to find from the source i.e

 Name: nuget.org
 Source: https://api.nuget.org/v3/index.json

This gives me result like this:

PM> Install-Package Newtonsoft.Json
Install-Package : Unable to find package 'Newtonsoft.Json' at source ''.
At line:1 char:1
+ Install-Package Newtonsoft.Json
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Time Elapsed: 00:01:30.2571879

I think that the source here is blank. May be because of that it is unable to load packages. I have tried to manage the package manager setting but not been able to connect. My package manager setting is like this:

Despite of having good connection of internet I am not been able to install package. My questions are:

  1. How should I install package?
  2. What am I doing wrong to install package?

回答1:


Assuming you are using Windows OS Have you initialised vs 2017 after installation or Have you updated your vs 2017?

  1. If not then please initialized it.
  2. Restart your PC.
  3. Open your project in vs 2017
  4. Check your nuget package manager settings.

    Name:nuget.org

    Source:api.nuget.org/v3/index.json

Now, run nuget package manager from tools=>Nuget Package Manager=>Package Manager Console and write your install-package command or run Manage nuget package manager for solution from tools=>Nuget Package Manager=>

Hope,it helps you.




回答2:


Your VS 2017 is probably using some kind of proxy setting which is preventing it from accessing the internet.

To check if VS can access internet try opening any web page from within VS Browser. If you cannot browse then my hunch is correct.

Solve the proxy issue and you should be fine.

Hope it helps.




回答3:


I resolved this issue by adding nuget.org which was missing in my package source.

Go to Tools>Nuget package manager>Package Sources>

Click Plus sign > Name: nuget.org Source : https://api.nuget.org/v3/index.json Now your Visual studio will be connected to Internet and package will be downloaded successfully.



来源:https://stackoverflow.com/questions/45050008/visual-studio-2017-professional-unable-to-find-package-at-source

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