执行本地 NuGet 包安装但出现错误 - 无法获取存储库签名信息

Doing a local NuGet package installation but getting the error - Unable to get repository signature information

我正在尝试按照 Samuel Jack 的回答进行脱机 NuGet 包安装: Text

1. Add the files to a folder called LocalPackages next to solution

2. Create a file called NuGet.config next to solution file

.nupkg 文件存储在本地并使用 NuGet 包管理器安装,但我收到此错误 - “无法获取源 https://api.nuget.org/v3-index/repository-signatures/5.0.0/index.json 的存储库签名信息。响应状态代码不表示成功:403 (禁止)。

我不明白为什么在我尝试进行离线安装时包管理器需要从 Internet 获取存储库签名信息。 Internet 连接在我的服务器中被阻止,这就是我收到 403 错误的原因。

如何在本地安装 NuGet 包而不出现错误?

How do I install the NuGet packages locally without getting the error?

您可以尝试以下步骤:

解决方案

1) 请确保在新的 Nuget.config 文件中有这些 xml 节点:

<disabledPackageSources> 

<add key="xxxxx"(the source name of api.nuget.org/v3-index/repository-signatures/5.0.0/index.json) value="true" /> 

</disabledPackageSources>

2) clean all nuget caches 或者删除 C:\Users\xxxx\.nuget\packages.

下的 packages 文件夹

3) 如果您在解决方案中添加新的 Nuget.config 文件,它无法立即运行,需要重新启动。你应该重启VS然后打开你的项目,然后就可以工作了。