问题
I have a warning message that came to dinner but now won't leave.
Multiple packages failed to uninstall. Restart Visual Studio to finish the process.
Unfortunately, however, restarting Visual Studio has no effect—the warning remains.
I've tried cleaning the solution as well as the project; all of my projects' assembly references are intact. I've also issued an Update-Package -Reinstall
command—which succeeded—to no avail.
How can I set about fixing this?
回答1:
I believe this may have been caused by a File Explorer folder lock.
I received a similar warning later, this time for a specific package; because I now knew which package it was I was able to use Lock Hunter to discover why it wasn't deleted.
I closed File Explorer, restarted VS, and the warning was no longer present. The original warning—the subject of this Q&A—was gone the next day, after having signed out and back in to Windows.
回答2:
I tried resetting permissions on the packages folder various different ways. Reset the owner, reset all child permissions, added my user account to permissions with full control etc... Tried killing Explorer process to release locks on files.
None of that worked.
What did work was to delete the entire contents of the packages folder (made a backup first) and let Visual Studio restore all the packages the next time I loaded it.
回答3:
This was a permission issue within the packages folder for me. Used a PS script to determine if files were locked or with other errors such as access denied; changed the permissions and restarted visual studio. All was good afterwards.
Here is the PS script used: Check for locked files in Directory and find locking applicaiton
Changed the gci command to include -Recurse.
回答4:
In my case, I had a shared project open in multiple solutions at the same time. Closing the other Visual Studio with the shared project fixed the issue.
回答5:
In my case it was due to files that were under source control, were not checked out, and so could not be deleted/updated..
If you look in the Output window, and select Package Manager, then it will show you a list of the problem files that can then be manually checked out in TFS/source control.
来源:https://stackoverflow.com/questions/43421825/persistent-warning-multiple-packages-failed-to-uninstall