【问题标题】:"Nuget failed to restore packages", but it worked fine before“Nuget 无法恢复软件包”,但之前运行良好
【发布时间】:2016-08-29 10:16:14
【问题描述】:

在启动时出现损坏的注册表警告后,我只需将 Windows 恢复到某个更新之前的状态,就可以成功地让我的 PC 再次运行。然而,由于一些完全未知的原因,Visual Studio 开始出现奇怪的行为。首先它没有检测到对 Renci.SSH.NET 的引用,尽管它显然存在。所以我进入了 nuget 包管理器,卸载了 SSH.NET,希望之后我可以重新安装它,一切都会好起来的。

显然,一切都没有那么顺利。如果我使用包管理器 GUI,Visual Studio 会告诉我“无法恢复包。正在恢复 'BlankApplication' 的包修改。”。如果我使用 nuget 控制台并输入 PM > Install-Package SSH.NET,我会在红色噩梦中突出显示:

Install-Package : SSH.NET 2016.0.0 is not compatible with UAP,Version=v10.0.
Au caractère Ligne:1 : 1
+ Install-Package SSH.NET
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Install-Package : SshNet.Security.Cryptography 1.2.0 is not compatible with UAP,Version=v10.0.
Au caractère Ligne:1 : 1
+ Install-Package SSH.NET
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Install-Package : System.Xml.XPath.XmlDocument 4.0.1 is not compatible with UAP,Version=v10.0.
Au caractère Ligne:1 : 1
+ Install-Package SSH.NET
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Install-Package : System.Xml.XPath 4.0.1 is not compatible with UAP,Version=v10.0.
Au caractère Ligne:1 : 1
+ Install-Package SSH.NET
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Install-Package : Some packages are not compatible with UAP,Version=v10.0.
Au caractère Ligne:1 : 1
+ Install-Package SSH.NET
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Install-Package : SSH.NET 2016.0.0 is not compatible with UAP,Version=v10.0 (win10-arm).
Au caractère Ligne:1 : 1
+ Install-Package SSH.NET
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Install-Package : SshNet.Security.Cryptography 1.2.0 is not compatible with UAP,Version=v10.0 (win10-arm).
Au caractère Ligne:1 : 1
+ Install-Package SSH.NET
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Install-Package : System.Xml.XPath.XmlDocument 4.0.1 is not compatible with UAP,Version=v10.0 (win10-arm).
Au caractère Ligne:1 : 1
+ Install-Package SSH.NET
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Install-Package : System.Xml.XPath 4.0.1 is not compatible with UAP,Version=v10.0 (win10-arm).
Au caractère Ligne:1 : 1
+ Install-Package SSH.NET
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Install-Package : Some packages are not compatible with UAP,Version=v10.0 (win10-arm).
Au caractère Ligne:1 : 1
+ Install-Package SSH.NET
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Install-Package : SSH.NET 2016.0.0 is not compatible with UAP,Version=v10.0 (win10-arm-aot).
Au caractère Ligne:1 : 1
+ Install-Package SSH.NET
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Install-Package : SshNet.Security.Cryptography 1.2.0 is not compatible with UAP,Version=v10.0 (win10-arm-aot).
Au caractère Ligne:1 : 1
+ Install-Package SSH.NET
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Install-Package : System.Xml.XPath.XmlDocument 4.0.1 is not compatible with UAP,Version=v10.0 (win10-arm-aot).
Au caractère Ligne:1 : 1
+ Install-Package SSH.NET
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Install-Package : System.Xml.XPath 4.0.1 is not compatible with UAP,Version=v10.0 (win10-arm-aot).
Au caractère Ligne:1 : 1
+ Install-Package SSH.NET
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Install-Package : Some packages are not compatible with UAP,Version=v10.0 (win10-arm-aot).
Au caractère Ligne:1 : 1
+ Install-Package SSH.NET
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Install-Package : SSH.NET 2016.0.0 is not compatible with UAP,Version=v10.0 (win10-x64).
Au caractère Ligne:1 : 1
+ Install-Package SSH.NET
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Install-Package : SshNet.Security.Cryptography 1.2.0 is not compatible with UAP,Version=v10.0 (win10-x64).
Au caractère Ligne:1 : 1
+ Install-Package SSH.NET
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Install-Package : System.Xml.XPath.XmlDocument 4.0.1 is not compatible with UAP,Version=v10.0 (win10-x64).
Au caractère Ligne:1 : 1
+ Install-Package SSH.NET
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Install-Package : System.Xml.XPath 4.0.1 is not compatible with UAP,Version=v10.0 (win10-x64).
Au caractère Ligne:1 : 1
+ Install-Package SSH.NET
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Install-Package : Some packages are not compatible with UAP,Version=v10.0 (win10-x64).
Au caractère Ligne:1 : 1
+ Install-Package SSH.NET
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Install-Package : SSH.NET 2016.0.0 is not compatible with UAP,Version=v10.0 (win10-x64-aot).
Au caractère Ligne:1 : 1
+ Install-Package SSH.NET
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Install-Package : SshNet.Security.Cryptography 1.2.0 is not compatible with UAP,Version=v10.0 (win10-x64-aot).
Au caractère Ligne:1 : 1
+ Install-Package SSH.NET
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Install-Package : System.Xml.XPath.XmlDocument 4.0.1 is not compatible with UAP,Version=v10.0 (win10-x64-aot).
Au caractère Ligne:1 : 1
+ Install-Package SSH.NET
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Install-Package : System.Xml.XPath 4.0.1 is not compatible with UAP,Version=v10.0 (win10-x64-aot).
Au caractère Ligne:1 : 1
+ Install-Package SSH.NET
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Install-Package : Some packages are not compatible with UAP,Version=v10.0 (win10-x64-aot).
Au caractère Ligne:1 : 1
+ Install-Package SSH.NET
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Install-Package : SSH.NET 2016.0.0 is not compatible with UAP,Version=v10.0 (win10-x86).
Au caractère Ligne:1 : 1
+ Install-Package SSH.NET
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Install-Package : SshNet.Security.Cryptography 1.2.0 is not compatible with UAP,Version=v10.0 (win10-x86).
Au caractère Ligne:1 : 1
+ Install-Package SSH.NET
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Install-Package : System.Xml.XPath.XmlDocument 4.0.1 is not compatible with UAP,Version=v10.0 (win10-x86).
Au caractère Ligne:1 : 1
+ Install-Package SSH.NET
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Install-Package : System.Xml.XPath 4.0.1 is not compatible with UAP,Version=v10.0 (win10-x86).
Au caractère Ligne:1 : 1
+ Install-Package SSH.NET
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Install-Package : Some packages are not compatible with UAP,Version=v10.0 (win10-x86).
Au caractère Ligne:1 : 1
+ Install-Package SSH.NET
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Install-Package : SSH.NET 2016.0.0 is not compatible with UAP,Version=v10.0 (win10-x86-aot).
Au caractère Ligne:1 : 1
+ Install-Package SSH.NET
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Install-Package : SshNet.Security.Cryptography 1.2.0 is not compatible with UAP,Version=v10.0 (win10-x86-aot).
Au caractère Ligne:1 : 1
+ Install-Package SSH.NET
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Install-Package : System.Xml.XPath.XmlDocument 4.0.1 is not compatible with UAP,Version=v10.0 (win10-x86-aot).
Au caractère Ligne:1 : 1
+ Install-Package SSH.NET
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Install-Package : System.Xml.XPath 4.0.1 is not compatible with UAP,Version=v10.0 (win10-x86-aot).
Au caractère Ligne:1 : 1
+ Install-Package SSH.NET
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Install-Package : Some packages are not compatible with UAP,Version=v10.0 (win10-x86-aot).
Au caractère Ligne:1 : 1
+ Install-Package SSH.NET
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

但这没有任何意义。几分钟前它工作得很好。我尝试卸载并重新安装 nuget,清理项目,清除 %AppData% 中与 NuGet 相关的所有内容,但没有任何效果。另外,请注意,如果我尝试创建一个新的空白项目,也会发生这种情况。

编辑:错误也发生在Microsoft.Toolkit.UWP 上,具有与UAP,Version=v.10.0 不兼容的相同症状。在崩溃之前,我还在我的项目中添加了这个包。但是,对于以前未安装的任何其他软件包,我没有遇到此问题。

【问题讨论】:

    标签: c# visual-studio-2015 nuget uwp nuget-package-restore


    【解决方案1】:

    我终于找到了解决办法:

    • 下载最新的nuget.exehere

    • 通过以管理员身份打开 nuget.exe 所在的 cmd 并运行 nuget locals all -clear

    • 来清除 nuget 缓存
    • 重新安装项目中的所有内容。这可能需要一段时间,但它解决了我的问题。
    • 如果您的系统目前看起来特别不稳定,请创建系统还原点。你永远不知道。

    【讨论】:

    • 感谢您在这里分享您的解决方案。请标记您的答案,这对遇到相同问题的其他社区有好处。
    猜你喜欢
    • 1970-01-01
    • 2017-11-09
    • 2018-06-26
    • 1970-01-01
    • 2018-05-29
    • 1970-01-01
    • 2014-06-26
    • 2017-02-17
    • 2021-07-28
    相关资源
    最近更新 更多