如何离线安装 Visual Studio Code 扩展? [英] How can I install Visual Studio Code extensions offline?

查看:48
本文介绍了如何离线安装 Visual Studio Code 扩展?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一台没有也不能连接到 Internet 的机器上安装了 Visual Studio Code.

从 Visual Studio Code 1.7.1 开始,拖动或打开扩展不再起作用.要手动安装它,您需要:

  • 打开扩展侧边栏
  • 点击右上角的省略号
  • 选择从 VSIX 安装

<小时>

旧方法

根据文档,可以下载一个直接扩展:

<块引用>

扩展程序的直接下载 URL 格式如下:

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

这意味着要下载扩展程序,您需要知道

  • 出版商名称
  • 版本
  • 扩展名

您可以在 URL 中找到所有这些信息.

示例

以下是下载安装 C# v1.3.0 扩展的示例:

发布者、扩展和版本

您可以在扩展程序主页的 URL 内找到发布者和扩展程序名称:

<块引用>

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

这里的发布者是 ms-vscode,扩展名是 csharp.

可以在更多信息区域的右侧找到该版本.

要下载它,您需要从上面的模板创建一个链接:

<块引用>

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

所有包都将具有相同的名称​​Microsoft.VisualStudio.Services.VSIXPackage,因此如果您想稍后知道它是哪个包,则需要在下载后重命名它.

安装

为了安装扩展

  • 重命名文件并为其指定*.vsix 扩展名
  • 打开 Visual Studio Code,进入菜单 File打开文件...Ctrl + O 并选择 .vsix 文件
  • 如果一切顺利,您应该会在窗口顶部看到以下消息:
<块引用>

扩展程序已成功安装.重新启动以启用它.

I have installed Visual Studio Code on a machine that is not, and cannot be, connected to the Internet. According to the documentation, I can install an extension from the command line if I have the .vsix, but I don't know how to get the .vsix from the marketplace.

How can I download the .vsix for an extension hosted on the marketplace?

解决方案

UPDATE 2017-12-13

You can now download the extension directly from the marketplace.

As of Visual Studio Code 1.7.1 dragging or opening the extension does not work any more. In order to install it manually you need to:

  • open the extensions sidebar
  • click on the ellipsis in the right upper corner
  • choose Install from VSIX


Old Method

According to the documentation it is possible to download an extension directly:

An extension's direct download URL is in the form:

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

This means that in order to download the extension you need to know

  • the publisher name
  • the version
  • the extension name

You can find all this information in the URL.

Example

Here's an example for downloading an installing the C# v1.3.0 extension:

Publisher, Extension and Version

You can find the publisher and the extension names on the extension's homepage inside its URL:

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

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

The version can be found on the right side in the More Info 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'll need to rename it after downloading if you want to know what package it was later.

Installation

In order to install the extension

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

Extension was successfully installed. Restart to enable it.

这篇关于如何离线安装 Visual Studio Code 扩展?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆