Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

One or more packages could not be completely uninstalled

Tags:

nuget

I have an ASP.NET MVC 4 application. I used NuGet to update all of the NuGet packages that were installed when I created the application. One of the packages was Microsoft.Bcl.Build.

After updating these, NuGet displayed the following message at the bottom of its window: NuGet error showing "One or more packages could not be completely uninstalled: Microsoft.Bcl.Build.1.0.7. Restart Visual Studio to finish uninstall."

I have since restarted Visual Studio several times, but the message still exists. When I checked the installed packages, it did appear that the updated version (1.0.8) of the package was present.

How can I fix this?

like image 771
Sam Avatar asked Aug 19 '13 00:08

Sam


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 reinstall NuGet package manager?

Switch to the Browse tab, search for the package name, select it, then select Install). For all packages, delete the package folder, then run nuget install . For a single package, delete the package folder and use nuget install <id> to reinstall the same one.


2 Answers

Instead of deleting all of ~/packages, see if there are any *.deleteme files in ~/packages and delete them. Then restart Visual Studio.

like image 196
Jedidja Avatar answered Sep 20 '22 03:09

Jedidja


I believe this problem is caused by the packages being read-only or otherwise inaccessible at the file system level.

Packages under source control

Temporary work-around (untested)

Check out the entire packages folder prior to telling NuGet to restart Visual Studio to delete the packages.

Permanent work-around

I found that this could be permanently resolved by removing the packages from source control and instead using NuGet Package Restore.

Packages not under source control

Temporary Work-Around

I worked around this by deleting from the solution's packages folder all of the files that referenced the package in question. Specifically, these were:

  1. Folder: Microsoft.Bcl.Build.1.0.7
  2. File: Microsoft.Bcl.Build.1.0.7.deleteme
like image 33
Sam Avatar answered Sep 22 '22 03:09

Sam