我试图给SignalR Sample一个试驾,但它似乎引用了一个不再可用的旧版SignalR。实际问题是NuGet无法在没有首先恢复它的情况下删除不可用的包!!!“
PM> Install-Package Microsoft.AspNet.SignalR
Install-Package : Some NuGet packages are missing from the solution. The packages need to be restored in order to build the dependency graph. Restore the packages before performing any operations.
At line:1 char:1
+ Install-Package Microsoft.AspNet.SignalR
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetMissingPackages,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
然后Restore
上会出现Package Manager Console
按钮按下它会导致以下错误:
An error occurred while trying to restore packages: Unable to find version '2.1.0-pre-131116-b279' of package 'Microsoft.AspNet.SignalR.Client'
如果找不到当前版本,如何安装较新版本的寻址软件包?
我正在使用:
Microsoft Visual Studio Community 2015
Version 14.0.24720.00 Update 1
Microsoft .NET Framework
Version 4.6.01038
NuGet Package Manager 3.3.0
[UPDATE]
当我尝试卸载麻烦的软件包时:
PM> Uninstall-Package -Id Microsfot.AspNet.SignalR -RemoveDependencies -Force
Uninstall-Package : Some NuGet packages are missing from the solution. The packages need to be restored in order to build the dependency graph. Restore the packages before performing any operations.
At line:1 char:1
+ Uninstall-Package -Id Microsfot.AspNet.SignalR -RemoveDependencies -F ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Uninstall-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetMissingPackages,NuGet.PackageManagement.PowerShellCmdlets.UninstallPackageCommand
答案 0 :(得分:27)
您可以通过以下方式手动删除依赖项:
答案 1 :(得分:10)
如果您知道Feed中当前存在的版本,那么这是一个更简单的解决方案。该解决方案可以修复每个项目中的每个包。
Update-Package -Reinstall
希望有所帮助
答案 2 :(得分:1)
对我有用的是:
1。转到packages.config文件,
2。找到“... id =”Microsoft.AspNet.SignalR.Client“version =”“targetFramework =”net45“......”
3。更改为现有版本,例如“2.2.0”。
4。保存。
5。转到Nuget,然后更新到最新版本。
答案 3 :(得分:1)
在评论中被@ferarias提及-如果您使用的是nuget.exe
,请尝试对其进行更新或下载latest version。
对我来说,从v4.4.1
升级到v4.6.2
足以解决Some NuGet packages are missing
错误。
答案 4 :(得分:0)
就我而言,我重新启动了Visual Studio。然后我从package.config中删除了nuget包条目。
之后,我能够恢复依赖关系。