How to install VSCode extensions offline?

I installed the VS code on a computer that is not and cannot be connected to the Internet. According to the docs , I can install the extension from the command line if I have .vsix , but I don't know how to get .vsix from the market.

How to download .vsix for an extension available on the market ?

+115
visual-studio-code vscode-extensions
May 6 '16 at 11:35 a.m.
source share
10 answers

UPDATE 2017-12-13

Now you can download the extension directly from the trading platform .

enter image description here

Starting with VSCode 1.7.1, dragging or opening an extension no longer works. To install it manually, you need to:

  • open extension sidebar
  • click on the ellipsis in the upper right corner
  • select Install from VSIX

Install from VSIX ...




Old method

According to the documentation, you can download the extension directly:

The direct download URL of the extension is:

 https://${publisher}.gallery.vsassets.io/_apis/public/gallery/publisher/${publisher}/extension/${extension name}/${version}/assetbyname/Microsoft.VisualStudio.Services.VSIXPackage 

This means that to download the extension you need to know

  • publisher name
  • version
  • extension name

You can find all this information in the URL.

example

Here is an example to download the installation of the C# v1.3.0 :

Publisher, Extension, and Version

You can find the publisher and extension names on the extension home page inside its URL:

https://marketplace.visualstudio.com/items?itemName= ms-vscode . CSharp

Here the publisher is ms-vscode and the extension is csharp .

The version can be found on the right in the " More Information" area .

To download it you need to create a link from the template above:

https://ms-vscode.gallery.vsassets.io/_apis/public/gallery/publisher/ms-vscode/extension/csharp/1.3.0/assetbyname/Microsoft.VisualStudio.Services.VSIXPackage

All packages will have the same name Microsoft.VisualStudio.Services.VSIXPackage, so you need to rename it after downloading if you want to know which package was later.

Mounting

In order to install the extension

  • Rename the file and give it the extension *.vsix
  • Open VS Code , go to File > Open File... or Ctrl+O and select the .vsix file
  • If everything went well, you should see this message at the top of the window:

The extension has been successfully installed. Restart to enable it.

+177
Aug 10 '16 at 7:31 on
source share

adding an answer to t3chb0t, I'm not sure why the download option is not visible, so I created a patch for those who use GreaseMonkey / TamperMonkey: you can find the gist code here

Or you can simply paste the bottom lines into the console of your browser and the link will magically look like this:

 let version = document.querySelector('.ux-table-metadata > tbody:nth-child(1) > tr:nth-child(1) > td:nth-child(2) > div:nth-child(1)').innerText , itemDetails = window.location.search.replace('?', '').split('&').filter(str => !str.indexOf('itemName')).map(str => str.split('=')[1])[0] , [author, extension] = itemDetails.split('.') , lAuthor = author.toLowerCase() , href = `https://${lAuthor}.gallery.vsassets.io:443/_apis/public/gallery/publisher/${author}/extension/${extension}/${version}/assetbyname/Microsoft.VisualStudio.Services.VSIXPackage` , element = document.createElement('a'); element.href = href; element.className = 'vscode-moreinformation dark'; element.innerHTML = 'download .vsix file'; element.download = `${extension}.${version}.vsix`; document.querySelector('.vscode-install-info-container').appendChild(element); 
+19
Dec 21 '16 at 10:03
source share

All of these suggestions are great, but it seems painful to follow, because executing the code to create a URL or constructing this crazy URL is annoying ...

So, I put together a quick web application to simplify the work. Just paste the URL of the desired extension and exit the download of your extension, which is already correctly named: publisher-extension-version.vsix.

Hope someone finds this useful: http://vscode-offline.herokuapp.com/

+14
May 14 '17 at 16:15
source share

To date, the download URL for the latest version of the extension is built verbatim into the source of the Marketplace page, for example. URL source:

https://marketplace.visualstudio.com/items?itemName=lukasz-wronski.ftp-sync

contains the line:

https://lukasz-wronski.gallerycdn.vsassets.io/extensions/lukasz-wronski/ftp-sync/0.3.3/1492669004156/Microsoft.VisualStudio.Services.VSIXPackage

I am using regexp from Python to retrieve the dl url:

 urlre = re.search(r'source.+(http.+Microsoft\.VisualStudio\.Services\.VSIXPackage)', content) if urlre: return urlre.group(1) 
+4
May 26 '17 at 12:15
source share

I wanted to throw the PowerShell load option onto the heap if someone else came across this. I have several scripts offline, and I run this in a loop to download and update all the extensions that I use offline.

 $page = Invoke-WebRequest -Uri 'https://marketplace.visualstudio.com/items?itemName=ms-vscode.PowerShell' $details = ( $page.Scripts | ? {$_.class -eq 'vss-extension'}).innerHTML | Convertfrom-Json $extensionName = $details.extensionName $publisher = $details.publisher.publisherName $version = $details.versions.version Invoke-WebRequest -uri "$($details.versions.fallbackAssetUri)/Microsoft.VisualStudio.Services.VSIXPackage" ` -OutFile "C:\Scripts\extensions\$publisher.$extensionName.$version.VSIX" 
+3
Apr 07 '17 at 9:10
source share

Adding to t3chb0t's excellent answer - use these PowerShell commands to install all the VSCode extensions to a folder:

 cd C:\PathToFolderWithManyDownloadedExtensionFiles Get-ChildItem . -Filter *.vsix | ForEach-Object { code --install-extension $_.FullName } 

Then reload VSCode to complete the installation.

+2
Mar 13 '18 at 16:22
source share

Now you can download the extension directly in the "Resources" section, there is a link "Download extension", I hope that this information is still useful.

+1
Nov 29 '17 at 20:14
source share

For Python users, the template for use with t3chbot 's excellent answer looks like this:

 https://marketplace.visualstudio.com/_apis/public/gallery/publishers/ms-python/vsextensions/python/{version_number}/vspackage 

Remember to scroll right to see where you should enter the version number.

0
Apr 09 '19 at 12:12
source share

If you are looking for a solution scenario:

  1. Get the binary URL to download: you can use the API, but keep in mind that there is no documentation for it. This API can return the URL for downloading .vsix files (see Example below)
  2. Download binary file
  3. Gently unzip binary into ~/.vscode/extensions/ : you need to change the unzipped directory name, delete one file and move / rename another.

For the API, start by looking at the following example and tips on how to change the request title: https://github.com/Microsoft/vscode/blob/master/src/vs/platform/extensionManagement/node/extensionGalleryService.ts .

 POST https://marketplace.visualstudio.com/_apis/public/gallery/extensionquery?api-version=5.1-preview HTTP/1.1 content-type: application/json { "filters": [ { "criteria": [ { "filterType": 8, "value": "Microsoft.VisualStudio.Code", }, { "filterType": 7, "value": "ms-python.python", } ], "pageNumber": 1, "pageSize": 10, "sortBy": 0, "sortOrder": 0, } ], "assetTypes": ["Microsoft.VisualStudio.Services.VSIXPackage"], "flags": 514, } 

Explanations for the above example:

  • "filterType": 8 - FilterType.Target more FilterTypes
  • "filterType": 7 - FilterType.ExtensionName more FilterTypes
  • "flags": 514 - 0x2 | 0x200 0x2 | 0x200 0x2 | 0x200 0x2 | 0x200 - Flags.IncludeFiles | Flags.IncludeLatestVersionOnly Flags.IncludeFiles | Flags.IncludeLatestVersionOnly Flags.IncludeFiles | Flags.IncludeLatestVersionOnly Flags.IncludeFiles | Flags.IncludeLatestVersionOnly - more flags
    • to get the decimal value of the flag, you can run python -c "print(0x2|0x200)"
  • "assetTypes": ["Microsoft.VisualStudio.Services.VSIXPackage"] - get only a link to a .vsix file larger than AssetTypes
0
Jun 27 '19 at 10:40
source share

If you have a specific (outdated) version of VSCode in a stand-alone instance, getting the latest extensions may not integrate correctly.

To ensure that VSCode and extensions work together, they must all be installed together on the online machine. This resolves any dependencies (with specific versions) and enables fine tuning of the standalone instance.

Quick steps:

Install the VSCode version, disable the update, and install the extensions. Copy the extensions from the installed location and place them on the target computer.

Detailed steps:

Install the exact version of VSCode on the online machine. Then disable the updates by going to File -> Preferences -> Settings . In the Settings window, under User Settings -> Application go to the Update section and change the parameter for Channel to none . This prevents VSCode from accessing the Internet and automatically updating your versions to the latest.

Then go to the VSCode extensions section and install all the extensions you need. Copy the installed extensions from the installation location (with its windows C:\Users\<username>\.vscode\extensions ) to the same location on the target computer.

Works great.

0
Aug 27 '19 at 16:28
source share



All Articles