尝试在 .Net 中安装包时出错 [英] Error caused when trying to Installing package in .Net

查看:86
本文介绍了尝试在 .Net 中安装包时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试使用以下命令在 Visual Studio 2017 中安装包时,

When I tried to install the Package in Visual Studio 2017 using below command,

PM> Install-Package Microsoft.IdentityModel -Version 7.0.0

我收到以下错误

尝试为项目Portal.System"收集包Microsoft.IdentityModel.7.0.0"的依赖信息,目标是.NETFramework,Version=v4.0"

Attempting to gather dependency information for package 'Microsoft.IdentityModel.7.0.0' with respect to project 'Portal.System', targeting '.NETFramework,Version=v4.0'

Install-Package:从源nuget.org"检索Microsoft.IdentityModel.7.0.0"的包元数据时出错.

Install-Package : An error occurred while retrieving package metadata for 'Microsoft.IdentityModel.7.0.0' from source 'nuget.org'.

发送请求时出错.
无法解析远程名称:'api.nuget.org' At line:1 char:1

error occurred while sending the request.
The remote name could not be resolved: 'api.nuget.org' At line:1 char:1

  • 安装包 Microsoft.IdentityModel -Version 7.0.0
 + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
 + FullyQualifiedErrorId : NuGetCmdletUnhandledException, NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

我该如何解决这个问题.

How can I fix this issue.

推荐答案

同意 zivkan,这个问题可能与您使用 VS2017 时的 Internet 连接有关.

Agree with zivkan, this issue could be related to Internet connection when you're using VS2017.

特别是您需要检查您是否可以通过 IE 浏览器访问 nuget.org 网站.我认为这个问题表明您的 DNS 提供商 有问题.请检查这一点并修复连接.

Especially you need to check if you can access nuget.org website by your IE browser. I think this issue indicates something is wrong with your DNS provider. Please check this point and fix the connections.

另外:如果您在代理后面使用 nuget.org,有关 nuget.config 可能会有所帮助.

In addition: If you're using nuget.org behind proxy, some details about the nuget.config may help.

这篇关于尝试在 .Net 中安装包时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆