visual-studio-code

vscode installed in other directory gives access denied error


I recently reinstalled my windows 10
For easy software management I chose to install all my software in the following directories:

This meant installing vscode and vscode-insiders on the C:\Program Files\
instead of the default C:\Users\User\AppData\...\

However when I am working I get notified with the following popup:
Error, Access is denied

clicking > Try again gives the same popup instantly
clicking > Cancel installation removes the popup for a short period
clicking > Skip this file keeps giving kind of the same access is denied error


Solution

  • The error comes from vscode wanting to update in the background.
    The C:\Program Files\ and C:\Program Files (x86) are restricted to admin
    So running vscode in admin mode will fix this issue.

    To make sure vscode runs in admin mode via this:
    Open with Code

    We need to make sure it always runs in admin mode:

    Opening the Code.exe with properties (right click and then properties).
    Switch to the Compatibility tab and tick the box before:
    Run this program as an administrator
    Remember do this only when you know what you are doing.
    Your are giving admin / sudo powers to vscode

    enter image description here

    This will fix the popup error.