Package management initialization failed: Access Denied Error when opening Visual Studio 2017
Asked Answered
P

7

40

I'm getting the following error when opening VS 2017 on Windows 7 64-bit:

Package management initialization failed: Access Denied.

You can get more information by examining the file:
C:\Users\<username>\AppData\Roaming\Microsoft\VisualStudio\15.<version>\ActivityLog.xml


It all started after I added my solution to SVN. I had no problems until I tried to add a file and got the following error:

Value does not fall within the expected range

I followed the steps mentioned in this answer and did a 'devenv /setup', after that I started getting the Package management initialization failed: Access Denied. error when opening VS. Now Visual Studio doesn't even start.

Has anyone else experienced this problem and resolved it?

Edit:

I tried starting as an administrator and it worked. But otherwise it doesn't.

Puklich answered 26/10, 2017 at 13:7 Comment(0)
P
73

It turns out that this is a bug, that hasn't yet been resolved. This error also occurs when starting Visual Studio after an update.

But there is a workaround from this thread that worked for me,

Delete the privateregistry.bin file from the following folder:

C:\users\%username%\Appdata\Local\Microsoft\VisualStudio\15.0_<version id>\

This is however a temporary fix and resets the user's preferences. That's why it worked when I started it as an administrator, since the problem is user specific.


Update

This bug is supposedly fixed in the latest versions of Visual Studio. But for the bug fix to work, the old privateregistry.bin file still needs to be deleted.

Puklich answered 26/10, 2017 at 13:44 Comment(10)
same problem, and same fix experienced after installing microsoft.net.compilers nuget package..Niu
same problem; same fix.Narah
19 June 2018 - problem still occursOverprint
@demonicdaron does the problem fix and then appear again? Have you updated VS to the latest version?Puklich
The fix works fine. After a couple of days the problems occurs again. I think the issue might be due to the fact that I don't have the latest version of VS17 installed (I am on 15.3.1, whilst the latest is 15.7). Unfortunately I work on a 3rd party managed desktop so I cannot update the software myself.Overprint
For problem to be fixed permanently, you need to update VS. Otherwise, at some point of time, it will corrupt the privateregistry.bin again. Try and get VS updated to the latest version.Puklich
I am on visual studio 2017 , version 15.7.5 and got this error, and deleting privateregistry.bin fixed the problem. Just a warning, deleting this file will mean you'll need to re-setup your VS config all over again.Petaloid
this error also occurs when you are out of disk spaceAnnorah
Error just occurred on a fresh install of VS 2019 Enterprise (16.4.2). Deleting privateregistry.bin and reopening worked.Deicer
I had the same problem today (Apr 2022) with VS2022 after installing an update. This answer fixed it for me (but the folder was 17.0 instead of 15.0).Myongmyopia
A
3

@Xpleria, the answer works fine. To open the AppData folder, you can type:

%AppData%

directly in the Address bar.

https://support.pointlogic.com/faq/troubleshooting/accessing-the-appdata-folder

enter image description here

Airtoair answered 26/7, 2018 at 7:10 Comment(0)
R
0

I had this issue after installing SSDT for VS 2017 in a new vs instance. So it's like I have two visual studio in my machine. To fix that, I uninstalled the SSDT package, restart my machine and reinstall it on the initial installed visual studio instance.

Rosaniline answered 30/11, 2018 at 15:42 Comment(0)
B
0

I had the same problem and when I looked at

 C:\Users\UserName\AppData\Local\Microsoft\VisualStudio 

I noticed that I had miltiple versions of visual studio meaning the current update might not have been successfull, as I was not able to delete the file that @Neil Patro says, I simply deleted the entire updates and all was ok. I guess adding this as an answer might help.

Board answered 24/2, 2019 at 10:17 Comment(0)
W
0

Happened to me with an existing VS instance running, where I disabled an extension (VsChromium). Closing all VS instances solved the error and VS starts normally. Env: VS 2019 Pro, Win 10 x64, running as current user.

Warfourd answered 21/1, 2020 at 9:17 Comment(0)
P
0

I had the same message, but it was because the Visual Studio Installer had been put on pause and then I had shut down the laptop. To give more context, I thought I had to click on the Visual Studio icon to resume the installation, turns out I had to go to Add or Remove Programas (Control panel) locate the Visual Studio Icon and on the 3 dots in front choose "Modify" to see the installation user interface. I hope this could help a bit.

Paper answered 27/10, 2023 at 23:10 Comment(0)
C
-1

Clear NuGet cache: The NuGet cache stores downloaded package files locally on your machine. Clearing the cache can help resolve issues related to corrupt or outdated package files. To clear the NuGet cache, follow these steps:

Close Visual Studio. Delete the contents of the following folders: %userprofile%.nuget\packages %localappdata%\NuGet\Cache

Centare answered 7/6, 2023 at 15:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.