How can you export the Visual Studio Code extension list?

Visual Studio-Code

Visual Studio-Code Problem Overview


I need to send all my installed extensions to my colleagues. How can I export them?

The extension manager seems to do nothing... It won't install any extension.

Visual Studio-Code Solutions


Solution 1 - Visual Studio-Code

Automatic

If you are looking forward to an easy one-stop tool to do it for you, I would suggest you to look into the Settings Sync extension.

It will allow

  1. Export of your configuration and extensions
  2. Share it with coworkers and teams. You can update the configuration. Their settings will auto updated.

Manual

  1. Make sure you have the most current version of Visual Studio Code. If you install via a company portal, you might not have the most current version.

  2. On machine A

    Unix:

     code --list-extensions | xargs -L 1 echo code --install-extension
    

    Windows (PowerShell, e. g. using Visual Studio Code's integrated Terminal):

     code --list-extensions | % { "code --install-extension $_" }
    
  3. Copy and paste the echo output to machine B

    Sample output

     code --install-extension Angular.ng-template
     code --install-extension DSKWRK.vscode-generate-getter-setter
     code --install-extension EditorConfig.EditorConfig
     code --install-extension HookyQR.beautify
    

Please make sure you have the code command line installed. For more information, please visit Command Line Interface (CLI).

Solution 2 - Visual Studio-Code

I've needed to do this myself a few times - especially when installing on another machine.

Common questions will give you the location of your folder

> Visual Studio Code looks for extensions under your extensions folder .vscode/extensions. Depending on your platform it is located:

Windows %USERPROFILE%\.vscode\extensions
Mac ~/.vscode/extensions
Linux ~/.vscode/extensions

That should show you a list of the extensions.

I've also had success using Visual Studio Code Settings Sync Extension to sync settings to GitHub gist.

In the latest release of Visual Studio Code (May 2016), it is now possible to list the installed extensions on the command line:

code --list-extensions

Solution 3 - Visual Studio-Code

I have developed an extension which will synchronise your all Visual Studio Code settings across multiple instances.

Key Features

  1. Use your GitHub account token.
  2. Easy to upload and download on one click.
  3. Saves all settings and snippets files.
  4. Upload key: Shift + Alt + U
  5. Download key: Shift + Alt + D
  6. Type Sync In Order to View all sync options

It synchronises the

  1. Settings file
  2. Keybinding file
  3. Launch file
  4. Snippets folder
  5. Visual Studio Code extensions

Detail Documentation Source

Visual Studio Code Sync ReadMe

Download here: Visual Studio Code Settings Sync

Solution 4 - Visual Studio-Code

Windows (PowerShell) version of Benny's answer

Machine A:

In the Visual Studio Code PowerShell terminal:

code --list-extensions > extensions.list

Machine B:

  1. Copy extension.list to the machine B

  2. In the Visual Studio Code PowerShell terminal:

     cat extensions.list |% { code --install-extension $_}
    

Solution 5 - Visual Studio-Code

I used the following command to copy my extensions from Visual Studio Code to Visual Studio Code insiders:

code --list-extensions | xargs -L 1 code-insiders --install-extension

The argument -L 1 allows us to execute the command code-insiders --install-extension once for each input line generated by code --list-extensions.

Solution 6 - Visual Studio-Code

For Linux

On the old machine:

code --list-extensions > vscode-extensions.list

On the new machine:

cat vscode-extensions.list | xargs -L 1 code --install-extension

Solution 7 - Visual Studio-Code

Generate a Windows command file (batch) for installing extensions:

for /F "tokens=*" %i in ('code --list-extensions')
   do @echo call code --install-extension %i >> install.cmd

Solution 8 - Visual Studio-Code

Dump extensions:

code --list-extensions > extensions.txt

Install extensions with Bash (Linux, OS X and WSL):

cat extensions.txt | xargs code --list-extensions {}

Install extensions on Windows with PowerShell:

cat extensions.txt |% { code --install-extension $_}

Solution 9 - Visual Studio-Code

> https://code.visualstudio.com/docs/editor/extension-gallery#_workspace-recommended-extensions

A better way to share extension list is to create workspace-based extension set for your colleagues.

After generating a list of extensions via code --list-extensions | xargs -L 1 echo code --install-extension (check your $PATH contains Visual Studio Code entry C:\Program Files\Microsoft VS Code\bin\ before running code commands), run Extensions: Configure Recommended Extensions (Workspace Folder) Visual Studio Code command (Ctrl + Shift + P) and put extensions into the generated .vscode/extensions.json file:

{
    "recommendations": [
        "eg2.tslint",
        "dbaeumer.vscode-eslint",
        "msjsdiag.debugger-for-chrome"
    ]
}

Solution 10 - Visual Studio-Code

If using bash, you can use the following commands:

Export extensions

code --list-extensions |
xargs -L 1 echo code --install-extension |
sed 's/$/ --force/' |
sed '$!s/$/ \&/' > install-extensions.sh

With bash alias:

# eve - export vscode extensions
alias eve="code --list-extensions |
xargs -L 1 echo code --install-extension |
sed 's/$/ --force/' |
sed '\$!s/$/ \&/' > install-extensions.sh"

Just run eve.

Install extensions

sh install-extensions.sh

Solution 11 - Visual Studio-Code

Open the Visual Studio Code console and write:

code --list-extensions (or code-insiders --list-extensions if Visual Studio Code insider is installed)

Then share the command line with colleagues:

code --install-extension {ext1} --install-extension {ext2} --install-extension {extN} replacing {ext1}, {ext2}, ... , {extN} with the extension you listed

For Visual Studio Code insider: code-insiders --install-extension {ext1} ...

If they copy/paste it in Visual Studio Code command-line terminal, they'll install the shared extensions.

More information on command-line-extension-management.

Solution 12 - Visual Studio-Code

How to export your Visual Studio Code extensions from the terminal. Here is git for that. Maybe this helps somebody.

How to export your Visual Studio Code extensions from the terminal

Note: Unix-like systems only.

  1. Export your extensions to a shell file:
code --list-extensions | sed -e 's/^/code --install-extension /' > my_vscode_extensions.sh
  1. Verify your extensions installer file:
less my_vscode_extesions.sh
Install your extensions (optional)

Run your my_vscode_extensions.sh using a Bash command:

bash my_vscode_extensions.sh

Solution 13 - Visual Studio-Code

Benny's answer on Windows with the Linux subsystem:

code --list-extensions | wsl xargs -L 1 echo code --install-extension

Solution 14 - Visual Studio-Code

There is an Extension Manager extension, that may help. It seems to allow to install a set of extensions specified in the settings.json.

Solution 15 - Visual Studio-Code

  1. code --list-extensions > list

  2. sed -i 's/.*/\"&\",/' list

  3. Copy contents of file list and add to file .vscode/extensions.json in the "recommendations" section.

  4. If extensions.json doesn't exist then create a file with the following contents

    {
        "recommendations": [
            // Add content of file list here
        ]
    }
    
  5. Share the extensions.json file and ask another user to add to the .vscode folder. Visual Studio Code will prompt for installation of extensions.

Solution 16 - Visual Studio-Code

Under windows typically I need to run

cd C:\Program Files\Microsoft VS Code\bin
code.cmd --list-extensions

What you don't do is run the code.exe directly under C:\Program Files\Microsoft VS Code\

Solution 17 - Visual Studio-Code

I opened the Visual Studio Code extensions folder and executed:

find * -maxdepth 2 -name "package.json" | xargs grep "name"

That gives you a list from which you can extract the extension names.

Solution 18 - Visual Studio-Code

Now there's a feature still in preview that allows you to sign in with a Microsoft or GitHub account and have your settings synced without any additional extension. It's pretty simple and straigh-forward. You can learn more here.

The things you can sync.

Solution 19 - Visual Studio-Code

If you intend to share workspace extensions configuration across a team, you should look into the Recommended Extensions feature of Visual Studio Code.

To generate this file, open the command pallet > Configure Recommended Extensions (Workspace Folder). From there, if you wanted to get all of your current extensions and put them in here, you could use the --list-extensions stuff mentioned in other answers, but add some AWK script to make it paste-able into a JSON array (you can get more or less advanced with this as you please - this is just a quick example):

code --list-extensions | awk '{ print "\""$0"\"\,"}'

The advantage of this method is that your team-wide workspace configuration can be checked into source control. With this file present in a project, when the project is opened Visual Studio Code will notify the user that there are recommended extensions to install (if they don't already have them) and can install them all with a single button press.

Solution 20 - Visual Studio-Code

For those that are wondering how to copy your extensions from Visual Studio Code to Visual Studio Code insiders, use this modification of Benny's answer:

code --list-extensions | xargs -L 1 echo code-insiders --install-extension

Solution 21 - Visual Studio-Code

If you would like to transfer all the extensions from code to code-insiders or vice versa, here is what worked for me from Git Bash.

code --list-extensions | xargs -L 1 code-insiders --install-extension

This will install all the missing extensions and skip the installed ones. After that, you will need to close and reopen Visual Studio Code.

Similarly, you can transfer extensions from code-insiders to code with the following:

code-insiders --list-extensions | xargs -L 1 code --install-extension

Solution 22 - Visual Studio-Code

For Linux/Mac only, export the installed Visual Studio Code extensions in the form of an installation script. It's a Z shell (Zsh) script, but it may run in Bash as well.

https://gist.github.com/jvlad/6c92178bbfd1906b7d83c69780ee4630

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAndrewView Question on Stackoverflow
Solution 1 - Visual Studio-CodeBennyView Answer on Stackoverflow
Solution 2 - Visual Studio-CodeMarkPView Answer on Stackoverflow
Solution 3 - Visual Studio-CodeShan KhanView Answer on Stackoverflow
Solution 4 - Visual Studio-CodemilanioView Answer on Stackoverflow
Solution 5 - Visual Studio-CodeMUG4NView Answer on Stackoverflow
Solution 6 - Visual Studio-CodeFaliesonView Answer on Stackoverflow
Solution 7 - Visual Studio-CodesadisaksView Answer on Stackoverflow
Solution 8 - Visual Studio-CodeMortenView Answer on Stackoverflow
Solution 9 - Visual Studio-CodegodblessstrawberryView Answer on Stackoverflow
Solution 10 - Visual Studio-CodeWenfang DuView Answer on Stackoverflow
Solution 11 - Visual Studio-CodeDamien LerouxView Answer on Stackoverflow
Solution 12 - Visual Studio-CoderohityadavView Answer on Stackoverflow
Solution 13 - Visual Studio-CodeÁlvaro GonzálezView Answer on Stackoverflow
Solution 14 - Visual Studio-CodeMichael_ScharfView Answer on Stackoverflow
Solution 15 - Visual Studio-CodecodescopeView Answer on Stackoverflow
Solution 16 - Visual Studio-CodegarlicbreadView Answer on Stackoverflow
Solution 17 - Visual Studio-CodeJuriView Answer on Stackoverflow
Solution 18 - Visual Studio-CodeGustavo SampaioView Answer on Stackoverflow
Solution 19 - Visual Studio-CodeezieglView Answer on Stackoverflow
Solution 20 - Visual Studio-CodeErikView Answer on Stackoverflow
Solution 21 - Visual Studio-CodenPcompView Answer on Stackoverflow
Solution 22 - Visual Studio-CodevladZamsView Answer on Stackoverflow