[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")

相关推荐
hqxstudying28 分钟前
MyBatis 和 MyBatis-Plus对比
java·数据库·mysql·mybatis
DarkAthena42 分钟前
AI生成技术报告:GaussDB与openGauss的HTAP功能全面对比
数据库·gaussdb
好奇的菜鸟1 小时前
使用 Apache Flink CDC 3.0 实现 MySQL 到 Elasticsearch 的数据同步
mysql·flink·apache
DemonAvenger2 小时前
高效JOIN操作:多表关联查询技巧与实战经验分享
数据库·mysql·性能优化
星夜泊客2 小时前
C# 浮点数与定点数详细解析
开发语言·c#·定点数·浮点数
小云数据库服务专线3 小时前
GaussDB 数据库架构师修炼(十八) SQL引擎-分布式计划
数据库·数据库架构·gaussdb
秋已杰爱4 小时前
Redis分布式锁
数据库·redis·分布式
haogexiaole11 小时前
Redis优缺点
数据库·redis·缓存
在未来等你11 小时前
Redis面试精讲 Day 27:Redis 7.0/8.0新特性深度解析
数据库·redis·缓存·面试
新法国菜13 小时前
MySql知识梳理之DML语句
数据库·mysql