Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
659 views
in Technique[技术] by (71.8m points)

visual studio - 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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Source:

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.0Common7IDEExtensions
  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.0Common7IDEExtensions_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.0Common7IDEExtensions
  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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...