Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to restore / remove / update a NuGet package because the mentioned version is no longer available

I'm trying to give the SignalR Sample a test drive but it seems it references an old version of SignalR which is no longer available. The actual problem is that NuGet cannot remove the unavailable package without first restoring it !!!

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 

Then there will be a Restore button on the Package Manager Console which pressing it will result in the following error:

An error occurred while trying to restore packages: Unable to find version '2.1.0-pre-131116-b279' of package 'Microsoft.AspNet.SignalR.Client'

How can I install a newer version of an addressed package if the current version can not be found?

I'm using:

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]

When I try to uninstall the troublesome package:

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 
like image 240
Mehran Avatar asked Dec 08 '15 03:12

Mehran


People also ask

How do I force a NuGet package to uninstall?

Right-click on Project and select Manage NuGet Packages option. Select the Installed tab from NuGet Package Manager dialog and you can see the installed Syncfusion NuGet packages list by giving the Syncfusion keyword in search. Uninstall the Syncfusion NuGet packages which are not required for the project.

How do I fix a NuGet package error?

Quick solution for Visual Studio usersSelect the Tools > NuGet Package Manager > Package Manager Settings menu command. Set both options under Package Restore. Select OK. Build your project again.


1 Answers

You can manually remove the dependency by:

  1. Close Visual Studio (not a hard requirement, but helpful)
  2. In text editor, remove dependency from all packages.config files
  3. Remove package from packages/ directory
  4. In text editor, remove all references to package from all .csproj files
  5. Start Visual Studio
  6. Reinstall package through NuGet
like image 171
Joe Hawkins Avatar answered Oct 13 '22 01:10

Joe Hawkins