[C#]无法获取源 https://api.nuge t.org/v3-index存储签名信息解决方法

参考网上大部分方法错误,根本不起作用。正确方法是

C:\Users\你的用户名\AppData\Roaming\NuGet找到NuGet.Config打开,看到类似下面信息(可能不一样)

复制代码
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageRestore>
    <add key="enabled" value="True" />
    <add key="automatic" value="True" />
  </packageRestore>
  <bindingRedirects>
    <add key="skip" value="False" />
  </bindingRedirects>
  <packageManagement>
    <add key="format" value="0" />
    <add key="disabled" value="False" />
  </packageManagement>
  <packageSources>
    <add key="nuget-ch" value="https://nuget.cdn.azure.cn/v3/index.json" />
    <add key="Microsoft Visual Studio Offline Packages" value="C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\" />
  </packageSources>
  <activePackageSource>
    <add key="nuget-ch" value="https://nuget.cdn.azure.cn/v3/index.json" />
  </activePackageSource>
</configuration>

找到关键词 https://api.nuget.org/v3/index.json

在关键词上下行加<disabledPackageSources>包裹起来,没有的话就把下面3行放对应位置

复制代码
    <disabledPackageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
    </disabledPackageSources>

最后

复制代码
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <disabledPackageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
    </disabledPackageSources>
    <add key="huawei" value="https://repo.huaweicloud.com/repository/nuget/v3/index.json" />
    <add key="Microsoft Visual Studio Offline Packages" value="C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\" />
    <add key="azure" value="https://nuget.cdn.azure.cn/v3/index.json" />
    <add key="tencent" value="https://mirrors.cloud.tencent.com/nuget/" />
  </packageSources>
  <packageRestore>
    <add key="enabled" value="True" />
    <add key="automatic" value="True" />
  </packageRestore>
  <bindingRedirects>
    <add key="skip" value="False" />
  </bindingRedirects>
  <packageManagement>
    <add key="format" value="0" />
    <add key="disabled" value="False" />
  </packageManagement>
</configuration>

注意:如果你项目里面有Nuget.config同样设置下

【附录】

添加资源

华为国内镜像

https://repo.huaweicloud.com/repository/nuget/v3/index.json

微软国内镜像

https://nuget.cdn.azure.cn/v3/index.json

腾讯镜像

https://mirrors.cloud.tencent.com/nuget/

Microsoft Visual Studio Offline Packages

C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\

国外nuget.org

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

【参考文献】

1\] [https://stackoverflow.com/questions/61380157/doing-a-local-nuget-package-installation-but-getting-the-error-unable-to-get-r](https://stackoverflow.com/questions/61380157/doing-a-local-nuget-package-installation-but-getting-the-error-unable-to-get-r "https://stackoverflow.com/questions/61380157/doing-a-local-nuget-package-installation-but-getting-the-error-unable-to-get-r")

相关推荐
Kookoos12 分钟前
Redis + ABP vNext 构建分布式高可用缓存架构
redis·分布式·缓存·架构·c#·.net
Leo.yuan41 分钟前
基于地图的数据可视化:解锁地理数据的真正价值
大数据·数据库·信息可视化·数据挖掘·数据分析
好吃的肘子1 小时前
MongoDB入门
数据库·mongodb
noravinsc1 小时前
人大金仓数据库 与django结合
数据库·python·django
代码配咖啡2 小时前
《Navicat之外的新选择:实测支持国产数据库的SQLynx核心功能解析》
数据库
懒大王爱吃狼2 小时前
怎么使用python进行PostgreSQL 数据库连接?
数据库·python·postgresql
时序数据说2 小时前
IoTDB集群的一键启停功能详解
大数据·数据库·开源·时序数据库·iotdb
Zhen (Evan) Wang2 小时前
ABP-Book Store Application中文讲解 - Part 2: The Book List Page
c#
小叶子来了啊2 小时前
信息系统运行管理员:临阵磨枪版
运维·服务器·数据库
数据库幼崽3 小时前
MySQL 8.0 OCP 1Z0-908 131-140题
数据库·mysql·ocp