简体   繁体   中英

failed to upgrade nuget for VS2015

i am in the process of installing a big C# project and i was told to upgrade nuget from 3.3 to 3.4 or above first.

I downloaded nuget extension (VS 2015 VSIX v3.4.4) and tried to install it, i got this:

8/7/2017 2:04:32 PM - Upgrading 'NuGet Package Manager for Visual Studio 2015', version 3.3.0.167 to version 3.4.4.1321.
8/7/2017 2:04:41 PM - 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)

I tried another way - from within VS2015, Tools -> Extensions and Updates, found existing nuget and tried to uninstall it first, I got:

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

I whipped out "Process explorer" and found that two processes used nuget: chrome and devenv.exe. devenv is a process with VS2015 instance. Anyway I exited VS2015, even chrome, no help, same error message as the one when installing the extension.

Other things I tried:

I found that nuget being used is at "C:\\Program Files (x86)\\NuGet", I replace the existing one with a new version of nuget.exe, as well as nuget.tools under C:\\Program Files (x86)\\NuGet\\Visual Studio 2015, then I started VS again still get the same message

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

I removed the packages folder under the project as well as that under /.nuget, didn't help.

I googled and found this link but it didn't help solve the problem either. I admit that I am at my wit's end.

failed to upgrade nuget for VS2015

This issue should be a bug or issue in the core visual studio extensibility. It is not a NuGet specific issue. It is generally tied to things like anti virus or encryption services . I would like provide some troubleshootings here:

  • Log in to your computer as an administrator and start Visual Studio with administrator.
  • Check if your computer has a McAfee Endpoint Encryption full-disk encryption product installed, not the antivirus. If yes, you should exclude devenv.exe and VSIXInstaller.exe from full-disk encryption.

    Here's a registry snippet to tell McAfee Endpoint Encryption to exclude these files. Once you do that, reboot PC: [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\services\\MfeEEFF\\ExemptedProcesses] "1"="devenv.exe" "2"="VSIXInstaller.exe"

    For the detail info, please check the answer for the same issue on SO.

  • Close visual studio and delete all the folders in C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\IDE\\Extensions that contain a copy of Nuget

    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

Hope this can give you some help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM