How can I upgrade Visual Studio Code?
Asked Answered
T

11

67

What's the best way to upgrade Visual Studio Code on Ubuntu?

For the time being, I was periodically getting the newest version (.deb) from their official site:

sudo dpkg -i code_*.deb
Tumor answered 22/3, 2017 at 19:13 Comment(0)
T
95

Visual Studio Code enabled official Linux repositories on February 2017 (v1.10)

sudo add-apt-repository -y "deb https://packages.microsoft.com/repos/vscode stable main "
sudo apt update
sudo apt -y install code

You can upgrade / dist-upgrade as usual

sudo apt -y upgrade
sudo apt -y dist-upgrade
Tumor answered 22/3, 2017 at 19:13 Comment(2)
In Debian 9.3.0 clean LDXE, the procedure above worked after I sudo apt-get install the following additional packages: software-properties-common apt-transport-httpsMiserable
I used sudo add-apt-repository -y "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main " to avoid getting a unsupported architecture message.Divan
O
22
  1. download the latest Visual Studio Code (.deb) package to your computer on this link:

    https://go.microsoft.com/fwlink/?LinkID=760868

    , or this there: Getting Started

  2. then open a terminal in the folder where you downloaded the .deb file and write:

     sudo dpkg -i <the downloaded file>.deb
    
  3. finally, if you have apt-get, do (if not, install apt-get first):

     sudo apt-get install -f
    
Ordinarily answered 26/12, 2017 at 7:36 Comment(0)
A
21

If you have installed it via the repository, exit Visual Studio Code, and then just do:

sudo apt update
sudo apt install code

This is the same command to install or upgrade to the latest version. You can see the version with:

code --version

Now the easiest and recommended way is to use snap:

sudo snap install --classic code

And updates are supposed to be automatic.

Adnah answered 15/1, 2019 at 8:52 Comment(0)
G
9

This works fine in Ubuntu:

sudo apt-get update
sudo apt-get install code
Gudren answered 21/4, 2020 at 8:18 Comment(0)
E
6
  1. When you install Visual Studio Code with the file .deb on Ubuntu 20.08, first, remove it:

    sudo apt-get remove code
    
  2. Add the repository in this link https://code.visualstudio.com/docs/setup/linux

     wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
     sudo install -o root -g root -m 644 packages.microsoft.gpg /etc/apt/trusted.gpg.d/
     sudo sh -c 'echo "deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/packages.microsoft.gpg] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
    
  3. Udate the package cache and reinstall

     sudo apt-get install apt-transport-https
     sudo apt-get update
     sudo apt-get install code
    
  4. In the next time when you want to upgrade, just do:

     sudo apt-get update
     sudo apt-get upgrade code
    

Because your repository is missing information to upgrade Visual Studio Code, the above solution will fix it.

Entablement answered 9/10, 2020 at 9:39 Comment(3)
There isn't any Ubuntu 20.08. Do you mean Ubuntu 20.04.8 (Focal Fossa)?Eberhardt
Though the last one in 20.04 appears to be 20.04.6(?). Is there a Ubuntu 20.04.8?Eberhardt
We are probably in a DenverCoder9 situation: "Last seen more than 1 year ago". Can somebody else chime in?Eberhardt
L
2

This is what I did to avoid the annoying message:

  1. Remove Visual Studio Code, if you already installed it.

    sudo apt-get remove code
    
  2. Add repositories, update and install:

    sudo add-apt-repository -y "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main "
    sudo apt update
    sudo apt -y install code
    
Luong answered 12/4, 2022 at 4:58 Comment(0)
E
2

The following commands work for me (for Linux):

wget 'https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-x64' -O /tmp/code_latest_amd64.deb
sudo dpkg -i /tmp/code_latest_amd64.deb

Place those two commands into an executable Bash script called auto-update-VSCode, and you can simply run that from your shell any time Visual Studio Code says it's out of date.

Engleman answered 25/7, 2022 at 4:31 Comment(3)
What Linux? Ubuntu? What version of Ubuntu was it tested on?Eberhardt
What are other valid parameters than build=stable? Would it also work for those?Eberhardt
What are other valid parameters than build=stable? insider? monthly? weekly? Would it also work for those? Where is the documentation for those parameters? The answer could be extended with some of this information. Download Visual Studio Code Insiders. What are the differences between Visual Studio Code and Visual Studio Code Insider?Eberhardt
B
1

I'm running Ubuntu 20.04 (Focal Fossa), and this worked perfectly for me:

wget https://vscode-update.azurewebsites.net/latest/linux-deb-x64/stable -O /tmp/code_latest_amd64.deb

sudo dpkg -i /tmp/code_latest_amd64.deb
Banger answered 17/9, 2020 at 11:17 Comment(1)
I get 404 not foundCho
B
0

If you have already installed Visual Studio Code, go to the terminal and type two different commands:

  1. sudo apt update
  2. sudo apt-get upgrade code
Bamboo answered 17/6, 2022 at 15:48 Comment(1)
duplicates stackoverflow.com/a/77376211Incoherence
P
0

The best way to update Visual Studio Code in Ubuntu:

sudo apt-get update
sudo apt-get install code
Picro answered 18/8, 2022 at 9:23 Comment(1)
Duplicates stackoverflow.com/a/77376211Incoherence
D
-1

I'm using Kali Linux and this option worked for me:

  1. sudo apt update

  2. sudo apt-get upgrade code

Dearly answered 19/4, 2023 at 14:14 Comment(1)
Duplicates stackoverflow.com/a/77376211Incoherence

© 2022 - 2024 — McMap. All rights reserved.