NuGet:正在还原...的软件包...已添加具有相同密钥的项目

时间:2020-07-22 14:37:32

标签: nuget visual-studio-2019

尝试将EF 6.4.4(或任何其他!!)NuGet软件包安装到项目时,我始终收到以下响应:

PM> Install-Package EntityFramework -Version 6.4.4
Install-Package : The WriteObject and WriteError methods cannot be called from outside the overrides of the BeginProcessing, ProcessRecord, and EndProcessing 
methods, and they can only be called from within the same thread. Validate that the cmdlet makes these calls correctly, or contact Microsoft Customer Support 
Services.
At line:1 char:1
+ Install-Package EntityFramework -Version 6.4.4
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], PSInvalidOperationException
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

我们非常感谢您的帮助。

1 个答案:

答案 0 :(得分:1)

NuGet:正在为…还原软件包 已添加

请尝试以下操作:

建议

1) clean all nuget caches或删除C:\Users\xxx(current user name)\.nuget\packages

下的任何nuget缓存

2),请确保您可以访问Internet并关闭所有防火墙或任何防病毒软件

,您可以尝试通过右键单击项目

来检查是否可以访问管理Nuget软件包下的软件包。

3)关闭VS,删除解决方案文件夹下的.vs隐藏文件夹,binobj文件夹,然后删除{下的nuget.config文件{1}},然后重新启动项目以再次进行测试。

,请启用C:\Users\xxx(current user name)\AppData\Roaming\NuGet软件包源,并在工具-> 选项-> Nuget软件包管理器-> 软件包来源

enter image description here

  • 启用nuget.org并禁用其他功能。

  • Package Manager控制台

    下运行nuget.org
  • 最后,选择nuget.org作为包源和正确的目标项目,然后安装update-package -reinstall进行再次测试。

enter image description here

此外,请尝试创建一个新项目,然后在其中安装该软件包,以检查问题是否仅在您当前的项目中发生。