Visual Studio 2017仅具有适用于.NET Core 2.x的脱机Nuget包.如何获得在线套餐?

Hoc*_*eyJ 12 c# visual-studio nuget .net-core

我想在线获取Nuget的NuGet包,但Visual Studio只提供"Microsoft Visual Studio Offline Packages"作为选项.

在此输入图像描述

我尝试使用以下URL添加另一个包源:

和其他几个,但我不断收到以下错误:

[Package source] Unable to load the service index for source http://packagesource. An error occurred while sending the request. The remote name could not be resolved: 'packagesource' [Nuget Online] The V2 feed at 'https://www.nuget.org/Search()?$filter=IsAbsoluteLatestVersion&searchTerm=''&targetFramework=''&includePrerelease=true&$skip=0&$top=26&semVerLevel=2.0.0' returned an unexpected status code '404 Not Found'.

如何获取.NET Core的在线包?

Hoc*_*eyJ 22

我认为答案是:

  1. 右键单击项目并选择Manage NuGet packages.

在此输入图像描述

  1. 单击Nuget包选项卡右上角的设置cog.

在此输入图像描述

  1. 在设置对话框中(如问题中的屏幕截图所示),单击+按钮.
  2. 为新来源提供名称和来源https://api.nuget.org/v3/index.json.

在此输入图像描述

这似乎对我有用

  • @DavidG对,它_应该是默认行为.在这里全新安装VS2017 CE,只提供离线包源. (4认同)
  • VS2019 的全新安装:相同的损坏行为。还必须手动添加`https://api.nuget.org/v3/index.json` (2认同)