25

I am new to Visual Studio. I have it set up with Git. When I have VS open, I keep on getting this error pop up: enter image description here

how do I get this to go away? I have tried running (and installing it) in administrator.

Win10 x64 build 19041 Visual Studio Code v1.49.2 x64

GenDemo
  • 749
  • 1
  • 7
  • 24
  • 5
    See https://github.com/microsoft/vscode/issues/75367 – Martheen Oct 05 '20 at 03:58
  • Thnx, that seems to have fixed it... I'll see once its run for a while... but its looking good. I can't accept your comment as an answer sadly. – GenDemo Oct 05 '20 at 06:01
  • 1
    I post it as comment because there's not enough information to pinpoint that it's indeed your problem. Feel free to update your question with your installer information, and post the solution as an answer – Martheen Oct 05 '20 at 06:02

10 Answers10

47
  • right click program directory (e.g. C:\Program Files\MicrosoftVsCode)
  • choose security tab
  • allow full control for users
Lars
  • 2,315
  • 2
  • 24
  • 29
15

It seems like using the default download is built to be installed in your AppData folder. Should you want to (like me) install it in your Program Files folder, go to https://github.com/microsoft/vscode/issues/75367 and follow the link there to https://code.visualstudio.com/docs/?dv=win64 and download the exe from there. This seems to have solved my problem.

Thank you to @Martheen

GenDemo
  • 749
  • 1
  • 7
  • 24
  • But the error is thrown in the program folder, i'm not sure what message you get when you install it in the AppData, in my case I used the Program folder and I still get the same message. – Yogurtu Aug 06 '21 at 12:25
  • just confirming, that the same error appears, when installed into AppData folder. Changing permissions like stated in the answer above (https://stackoverflow.com/a/69033240/3540223) solves the problem – birnchen7 Apr 13 '22 at 16:49
3

No you don't have to do all that, all you have to do is:

Right-click on VS Code > Properties > Compatibility Tab > Select Run as Administrator

Then it should be fine.

This issue happens when VS Code is trying to update in the background but cannot because it is not running as the administrator.

pH4nT0M
  • 175
  • 2
  • 10
3

The workaround solution is to add the user to have Full Control on the %LOCALAPPDATA%\Programs\Microsoft VS Code folder.

The following PowerShell script (run as Admin) can replace the user permissions temporarily and resolve the immediate issue:

$folder = "$env:LOCALAPPDATA\Programs\Microsoft VS Code\"
$username = "$env:USERDOMAIN\$env:USERNAME"
    
$newAccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule($username, "FullControl", 3, "None", "Allow")
    
$acl = Get-ACL $folder
$acl.AddAccessRule($newAccessRule)
    
Set-ACL $folder -AclObject $acl

This allows the installer/updater to continue by clicking Try Again.

Installation method

This question pertains to the per-user installation of VS Code. This is a valid installation method, and the default method.

The alternative is the Program Files-based (system-wide) installation.

Root cause?

I'm unsure why the user's permissions were lost on the folder. By default the user should have access to their own AppData directory. Something had set the permissions to Admin only (i.e. requiring elevation).

Perhaps the root cause is due to an elevated VS Code doing an update?

More discussion on https://github.com/microsoft/vscode/issues/148953

Jake Edwards
  • 1,190
  • 11
  • 24
  • This was the answer for me. Combined with Jonathon Anderson's answer, it explains what happened in my case. In short, it was due running winget in elevated command prompt. – GaTechThomas Jul 06 '23 at 19:54
  • This would also fix the issue for other vscode based tools, such as Azure Data Studio. Just be sure to look at folder $env:LOCALAPPDATA\Programs\ to see where it got installed, and update the script in this answer to use that folder. – GaTechThomas Jul 06 '23 at 19:55
1

Run it as an administrator.

It seems that VS Code had to install an update and couldn't due to permission restrictions. I simply closed VS Code and re-opened as an Administrator. I then went to Help → Check for Updates. All the updates were installed appropriately and the error was gone.

In case that doesn't work, apply the steps provided by Lars and then run as administrator.

M. Al Jumaily
  • 731
  • 1
  • 6
  • 21
1

For me, this issue occurred because I had used winget to install VS Code from an elevated command prompt. This caused the owner of the Microsoft VS Code folder to be set as the MyPC\Administrators group instead of MyPC\MyUserAccount.

Even though I am already a member of that group, I think the privileges of the administrator group don't apply unless you run the application with administrator privileges. UAC and all that.

The fix for me was uninstalling VS Code and reinstalling with winget from a standard command prompt.

You should not need to mess with permissions on the folder.

Jonathon Anderson
  • 1,162
  • 1
  • 8
  • 24
0

This error also occurred to me several times, so what I did was stopped the scanning done by antivirus software. You can go to settings of your antivirus software and stop or disable scanning of apps while they download.

Dharman
  • 30,962
  • 25
  • 85
  • 135
0

This error appeared after uninstalling the jshint extension, I reinstalled it but left it disabled, that's how it was solved for me.

0

On my PC when I opened directly a file or folder this error appeared... So, I renamed all 3 uninstall (below)* files and problem solved.

*(unins000.exe, unins000.dat & unins000.msg)


PC & Visual Studio Code Version:

Version: 1.68.0 (user setup) Date: 2022-06-08T11:44:16.822Z Electron: 17.4.7 Chromium: 98.0.4758.141 Node.js: 16.13.0 V8: 9.8.177.13-electron.0 OS: Windows NT x64 6.3.9600 Set on: Windows 8.1 x64-bit OS

-1

Goto C:\Users\aarifhusain\AppData\Local\Programs

(aarifhusain is my pc user directory, On your pc, it will be different)

Right click program directory on "Microsoft Vs Code" folder

  • Choose security tab

allow full control for

  • Creator owner
  • Authenticated users
  • SYSTEM
  • Administrator(AARIFHUSAIN/Administrator)
  • Users(AARIFHUSAIN/Users)

Allow "full control" for everyone.

enter image description here

Now error Resolved successfully. Upvote this answer

Aarif Husain
  • 424
  • 5
  • 8