在 Visual Studio 中使用包管理器控制台为 ASP.NET MVC 安装包时遇到问题

Facing issue while installing Package using package Manager console in Visual Studio for ASP.NET MVC

使用包管理器控制台从 Visual Studio 安装任何包时,出现错误 - 如何解决?

PM> Install-Package Microsoft.AspNet.MVC

Install-Package : Unable to find package 'Microsoft.AspNet.MVC' at source ''.
At line:1 char:1

  • Install-Package Microsoft.AspNet.MVC
  • 
    
  • CategoryInfo : NotSpecified: (:) [Install-Package], Exception
  • FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

在输出 window 中,它显示了这些消息:

[Package source] Unable to load the service index for source https://packagesource.

An error occurred while sending the request.
The remote name could not be resolved: 'packagesource'

请从选项中添加包源。

工具 -> 选项 -> Nuget 包管理器

添加新源并根据需要添加名称,并在源中添加 https://api.nuget.org/v3/index.json。并保存。