Unable to open or uninstall Visual Studio Code - visual-studio-code

I downloaded visual studio code a while ago but was never able to open it. When I open the app, I get the error "unable to write program user data". When I run as administrator, a window opens briefly before closing again. When I try to uninstall the program, I get error 5, "unable to create a temporary file. Setup aborted."
I have tried to create new TEMP and TMP directories but it made no difference.
This is on windows 11, the x64 bit version of vscode.
I have installed and used the same version of Visual Studio Code on a previous device (with windows 10 however) and never had any issues.

If you are not allowed to write data.
It means you do not have the necessary permissions for the directories. I see you tried already to run as ADM.
Try to check if your user account got the necessary permissions to write in the directories that you want. In the error message, maybe it shows the directory in question, if not, try first the VSC directories or the PROJECT directory. See below:
To do this, navigate to the directories specified (Or project directory) in the error message and right-click on them. Select "Properties" and then go to the "Security" tab. Make sure that your user account is listed and has the "Full control" permission.
You can also try to reset the settings for VSCode, by running the command Code --reset-settings in the command prompt.

Related

VS Code Failed to Install Visual Studio Code Update

I am trying to update my VS Code but am getting an error message: Updates may fail due to anti virus software and/or runaway processes.
A log file stemming from my Users was attached, but I am not sure what to check for. I am still new to computers and programming.
I copied the Code.exe file from where my program was installed and pasted it to the temp map: C:\Users\YOUR_USERNAME\AppData\Local\Programs\Microsoft VS Code
I reran the update and it works.
Run the update setup file, with a name like "CodeSetup-stable-...exe", in the following location:
C:\Users\<:User>\AppData\Local\Temp\vscode-update-system-x64
Replace <:User> with your username. And make sure VS Code is closed.
The same problem happened to me as well. It was because I installed VS Code in another directory other than the default location. The problem happened because after downloading the update in the Temp directory, VS Code tried to locate the previous installation in the default location to update it. As it failed, the update setup file remained with the temporary files. The problem was solved by manually installing the update.
This is how I resolved the problem:
Close VSCode.
Run VSCode AS ADMINISTRATOR by right clicking in the VS Code icon. This process opens VScode.
Now run the same VSCODE update as usual from inside VSCode.
VSCode closes after the update process and the latest VSCODE version is installed.
This happens because you installed VSCode in a specific directory, delete and download again but leave the default directory. This is because the update file looks for the default directory
This problem appeared to me because I moved the files of the setup of the vscode from Partition to another, and the solution was very simple. I opened the file that was in the path that appeared in the alert, and the problem was solved.
Just make sure any instance vscode was closed!

Why Visual Studio code and most of the applications are not installing in fresh windows 10?

I am trying to install Visual Studio Code in my fresh windows 10 but it is throwing an error Setup was unable to create a directory
Error 5: Access is denied
Since your UAC(User Account Control) is turned off, and you are running the install as Admin (because you already are admin), it seems like a permission issue and not a UAC issue. Try this:
Create a folder name "Temp" under C:\ // This step is important, the
folder has to exist.
Right click the Computer in Start menu and select Properties. Click
Advanced System Setting. In System Properties windows, click
Advanced tab.
Click Environment Variables button. Under User
variables list, double click TMP.
Change Variable value: from
"%USERPROFILE%\AppData\Local\Temp" to "C:\Temp".
Try to install.

In Visual Studio Code, I get "The PowerShell session has terminated due to an error..."

I'm new to Visual Studio Code. In VSC, I can open a file fine. It's when I try to open another folder that I have a problem. When I do that, the VSC screen goes blank, then I get:
"The PowerShell session has terminated due to an error, would you like
to restart it? [Yes, No, Close]"
...and then after a second or so it chooses one of those options for me (it doesn't let me enter anything) and now I'm looking at the new folder's contents.
I have 2 separate PCs, one Win7, the other Win10. Occurs the same on both. Version 1.15.1. I can open multiple files from the same folder fine, but not from separate folders without getting the PowerShell session termination message.

Can't find Visual Studio Code on windows 8.1 not in start screen

Just installed Visual Studio Code, and noticed I can't find it by searching in the start screen.
The default installation location is in %APPDATA%, which by default isn't indexed by Windows.
What's the solution to this?
I've read that adding %APPDATA% to the indexing can slow it down considerably because of the sheer number of files there.
I experienced the same thing on Windows 10, and this is what I learned:
I found that it's in: C:\Users\ USERNAME \Appdata\Local\Code\ APPVERSION \code.exe
where USERNAME is the username on the computer, and APPVERSION is the version of code installed (example, my folder is app-0.5.0 so it would be in C:\users\user1\appdata\local\code\app-0.5.0\code.exe
I right-clicked on Code.exe and chose "Pin to Start" and now I can launch VS Code from start menu.
What's even stranger (to me), is Code installed into the user directory of the user account that I'm not logged into at the moment. I have user1 and user2. I'm logged in as User1. Code installed in User2's Appdata directory!
I had a similar problem, so I right clicked on a html file and selected open with vs code. Once the application was open, I pinned it to the taskbar. And now I can access it anytime.

Install VSCode in a specific folder

I just downloaded the Visual Studio Code App from https://code.visualstudio.com/ and when I tried to install it, it simply just installed it by itself, without the option to change the installation path.
I have an external harddrive, which is where I want the IDE to be placed instead of the Local Harddrive. How can I change this?
On the VSCode download page select "System Installer" instead of "User Installer". The System installer will prompt you for the install location.
Full credit to Hans Passant for giving the following working solution as a comment.
The installer does very little beyond copying the files, it just creates some Explorer context menu shortcuts ("Open with Code"). Otherwise following Chromium conventions and copying itself to c:\Users\yourname\AppData\Local\Code\app-0.1.0 so it can update itself without you noticing. Boo. So high odds that simply moving that folder to the other drive works just fine, put it anywhere and create a shortcut to Code.exe. If you still want the context menu entry to work then use Regedit and search for "code\app-0.1.0".