Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't Update or Uninstall NuGet Package Manager in VS2012

I am unable to update or uninstall the NuGet Package Manager for Visual Studio 2012. I've looked around to several solutions, but have not found one that works.

Running Visual Studio 2012 as the administrator...

Attempting to update the NuGet Package Manager fails, and I get this error dialog with the following at the end of the log:

enter image description here

2/5/2013 10:38:09 AM - Beginning to install extension to Microsoft Visual Studio Ultimate 2012... 2/5/2013 10:38:09 AM - Upgrading 'NuGet Package Manager', version 2.0.30625.9003 to version 2.2.31210.9045. 2/5/2013 10:38:10 AM - Install Error : System.IO.IOException: The process cannot access the file because it is being used by another process. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.__Error.WinIOError() at System.IO.File.InternalMove(String sourceFileName, String destFileName, Boolean checkHost) at Microsoft.VisualStudio.ExtensionManager.ExtensionManagerService.AtomicallyDeleteFiles(IEnumerable1 filePaths, Boolean justMarkForDeletion) at Microsoft.VisualStudio.ExtensionManager.ExtensionManagerService.DeleteDiscoverableFiles(IInstalledExtension extension) at Microsoft.VisualStudio.ExtensionManager.ExtensionManagerService.UninstallInternal(IInstalledExtension extension, Boolean forceDelete) at Microsoft.VisualStudio.ExtensionManager.ExtensionManagerService.CommitInstalledAndUninstalledExtensions(IEnumerable1 installedExtensions, IEnumerable1 uninstalledExtensions, IEnumerable1 packComponentChanges) at Microsoft.VisualStudio.ExtensionManager.ExtensionManagerService.BeginInstall(IInstallableExtension installableExtension, Boolean perMachine, AsyncOperation asyncOp) at Microsoft.VisualStudio.ExtensionManager.ExtensionManagerService.InstallWorker(IInstallableExtension extension, Boolean perMachine, AsyncOperation asyncOp)

Followed by a popup telling me:

The process cannon access the file because it is being used by another process.

enter image description here

When I attempt to uninstall the extension first (per some solutions) I receive the same pop-up message as above, telling me the process is being used!

Steps I've made in my attempts to get this working:

  1. I've restarted VS2012 multiple times, with and without projects loaded.
  2. I've rebooted the computer several times and started nothing other then VS2012.
  3. I've downloaded the NuGet installer from the web and tried to install it w/o starting VS2012 (first thing after reboot).

For step #3, I receive the same series of dialogs/errors as when attempting to update inside Visual Studio 2012.

I can't get the latest version, no matter what I try! Does anyone have another trick?

I've also noticed that NuGet is just plain not working right now. Neither the "Package Manager Console" or the "Package Manager Settings" do anything.

like image 408
Nicholas Pappas Avatar asked Feb 05 '13 18:02

Nicholas Pappas


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 uninstall and 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.


1 Answers

Source:

  • http://www.paraesthesia.com/archive/2013/07/30/upgrading-nuget-the-process-cannot-access-the-file-because-it.aspx

This is what helped me:

  1. Close all instances of Visual Studio.
  2. Go to your global Visual Studio extensions folder. NuGet doesn’t install in your per-user folder; instead, you’ll see it in Program Files. Something like: C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions
  3. Look in that folder. You will see a lot of randomly named folders like “sdjfksiov.djd” and so on. Most (if not all) of those are NuGet. You’ll want to be aware of which ones are NuGet and which ones aren’t, particularly if you have other extensions installed. (You can tell if it's NuGet because it'll have a bunch of NuGet.*.dll files in there. If you don't see NuGet stuff in there, you'll want to keep it.)
  4. Rename that Extensions folder to something like: C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions_RENAMED
  5. Download NuGet directly from the Visual Studio extension gallery.
  6. Execute the downloaded NuGet.Tools.vsix file you just downloaded. Don’t do it through Visual Studio. Just double-click the .vsix file to install it.
  7. NuGet should successfully install. As part of that install, it will create the Extensions folder again, so you will once again see C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions
  8. Open up your renamed extensions folder and move all of the non-NuGet extensions into the new Extensions folder.
  9. Now open Visual Studio. You should see the new version of NuGet installed and working.
  10. You can delete that renamed Extensions folder once you’ve verified everything is working.
  11. Download VSIX and right click unblock the file and install again
like image 98
nihique Avatar answered Oct 04 '22 19:10

nihique