53

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?

1
  • Ahh, BCL. Yea, MS updated a lib that created a dependency on that package that most source controls choke on because of the exclude paths. Aug 19, 2013 at 0:14

9 Answers 9

86

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

4
  • I had to stop Visual Studio before I could remove the folder since it was "in use".
    – Robert
    Feb 17, 2015 at 10:11
  • If you have multiple solutions in the same project then you need to delete the *.deleteme files in ~/packages from each solution.
    – georger
    Nov 27, 2015 at 14:45
  • Yep! Deleting SimpleImpersonation.2.0.1.deleteme file worked for me. There was only one such file having deleteme extension. I had to exit Visual Studio before being able to delete the file.
    – RBT
    Jul 7, 2017 at 9:35
  • That did it for me. Aug 10, 2017 at 9:22
47

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
2
  • 2
    In my case a completely different process had locked one of the folders inside nuget packages. Once I used one of those tools to view what process is locking what file/folder and unlocked it, the problem was resolved. Mar 4, 2014 at 4:12
  • The top temporary work around also works with Visual Studio 2015 May 18, 2016 at 12:49
8

In my case, the relevant package folders remained in ~\packages, although they were empty. I deleted the folders and restarted Visual Studio, and this warning went away.

1
  • 1
    This worked for me as well, restarting Visual Studio is important.
    – Evidica
    Mar 12, 2014 at 14:34
3

I've just deleted the folders of each package that had error in the Packages folder in my solution folder and also deleted the .deleteme files and everything works fine!

1
  • I had to use TaskManager to close the devenv processes.
    – OzBob
    Apr 28, 2016 at 6:28
2

1) Delete the entire ~\packagesfolder.

2) Restart VS.

3) Go to Manage NuGet Packages and Restore

1
  • After deleting the "Deleteme" file, I had to do a Restore to make everything works fine. Apr 22, 2015 at 9:45
1

I'll agree that this can happen when your packages folder is under source control. If you like to have it there, instead of removing the bindings you can check it all out, remove the package with the NuGet Package Manager, and then check in after wards.

1

In my experience, I found my answer on this thread, but using a combination of a couple of different answers above so I thought I would share what I found.

I had the exact same issue with "Microsoft.Bcl.Build" as the original poster. I had been trying to update references for other functionality using NuGet and had issues with some of the updates (compatibility then rollbacks). After this NuGet failure, I started getting this error.

I initially used the selected answer and Jedidja's answer and was able to get this to work, but it only partially solved my problem. It did fix the VS restart error, but it caused a downstream issue with TFS as I could no longer check in the project as it was expecting that "*.deleteme" file. This got me thinking, so I did some testing. When I restored the file from recycle bin, I started getting the restart error again.

Here is where I deviated from the posted answers and got my full resolution to my version of the problem.

When I checked into TFS this time, the project checked everything in (after I got the projects all updated using NuGet while the "*.deleteme" file was deleted). Once it checked everything in, I noticed that file was still pending check-in so I checked the solution in again and TFS accepted that file, but it was as a deletion....assuming it checked in the first time and then VS auto deleted it which required the second check-in. Anyway....after the last pending change check-in, the file was gone and VS no longer complained about needing to be restarted. I can't say for sure because the problem is gone, but I get the feeling if I had checked the code in before deleting the file in the first place it might have solved the problem without manual file manipulation.

0

** Hi, everybody.**

i resolve this problem this ways.

  1. If you have source control run the vs as administrator ( it is important )

  2. in the solution packages -> delete thing about packages. sample -> i deleted all entity framework version folders.

  3. restart the vs

  4. open solution and solution right click -> manage nuget packages for this solution. you will see restore button :) restore

that is all.

0

If you are using Entity Framework 6, then you can install the NuGet package "EntityFramework.SqlServerCompact".

This enabled me to use the standard ASP.NET Identity tooling that comes with the project templates for 2013 and MVC5.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.