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

相关推荐
枯萎穿心攻击34 分钟前
响应式编程入门教程第二节:构建 ObservableProperty<T> — 封装 ReactiveProperty 的高级用法
开发语言·unity·c#·游戏引擎
Eiceblue2 小时前
【免费.NET方案】CSV到PDF与DataTable的快速转换
开发语言·pdf·c#·.net
好奇的菜鸟2 小时前
如何在IntelliJ IDEA中设置数据库连接全局共享
java·数据库·intellij-idea
tan180°2 小时前
MySQL表的操作(3)
linux·数据库·c++·vscode·后端·mysql
满昕欢喜3 小时前
SQL Server从入门到项目实践(超值版)读书笔记 20
数据库·sql·sqlserver
DuelCode3 小时前
Windows VMWare Centos Docker部署Springboot 应用实现文件上传返回文件http链接
java·spring boot·mysql·nginx·docker·centos·mybatis
幽络源小助理4 小时前
SpringBoot基于Mysql的商业辅助决策系统设计与实现
java·vue.js·spring boot·后端·mysql·spring
Hello.Reader4 小时前
Redis 延迟排查与优化全攻略
数据库·redis·缓存
简佐义的博客5 小时前
破解非模式物种GO/KEGG注释难题
开发语言·数据库·后端·oracle·golang
爬山算法5 小时前
MySQL(116)如何监控负载均衡状态?
数据库·mysql·负载均衡