如何使用 tfs-cli (tfx) 更新本地 TFS 实例的 TFS 扩展? [英] How do I use the tfs-cli (tfx) to update a TFS extension for an on-premise TFS instance?

查看:23
本文介绍了如何使用 tfs-cli (tfx) 更新本地 TFS 实例的 TFS 扩展?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的公司有一个本地 TFS 2017 实例.我知道如何通过 Web 界面安装和更新扩展程序,但这很乏味.我想知道是否有使用 tfs-cli 更快的方法.

My company has a on-premise TFS 2017 instance. I know how to install and update extensions through the web interface, but it's pretty tedious. I'm wondering if there's a quicker way to do it with tfs-cli.

推荐答案

由于某种原因,我花了一段时间才弄明白.起初我以为 tfs-cli 只能用于向 Visual Studio Marketplace 发布扩展,但事实并非如此.以下是对本地 TFS 执行此操作的方法:

Took me awhile to figure this out for some reason. At first I thought tfs-cli could only be used to publish extensions to the Visual Studio Marketplace, but that's not the case. Here's how to do it for on-prem TFS:

您可以按照此处的说明.或者:

  1. 将鼠标悬停在右上角的个人资料图片上.
  2. 选择安全".
  3. 如果尚未选择,请选择个人访问令牌"部分.
  4. 单击添加"按钮以生成新令牌.
  5. 如果您想限制范围,只需选择市场(发布)"选项.
  6. 点击创建令牌".
  7. 复制并保存在安全的地方!

登录

在命令行中输入以下内容:

Login

Enter the following in the commandline:

tfx 登录

系统会提示您输入在上一步中生成的服务 URL 和个人访问令牌.

You'll be prompted to enter the service URL and the personal access token you generated in the last step.

对于服务 URL,请使用贵公司用于访问 TFS 的任何内容.示例网址:

For the service URL, use whatever your company uses to access TFS. Example URLs:

注意事项:

  1. 指定 http/https.
  2. 您可能/可能不需要指定端口号.
  3. 根据您运行的 TFS 2017 版本及其安装方式,您可能需要也可能不需要在 URL 中包含 /tfs/.例如,可以去掉 /tfs/ 虚拟目录 安装时.查看您在浏览器中使用 TFS 时使用的 URL 以及相应的命令.

打包您的扩展程序

  1. 导航到扩展程序的根目录.
  2. tfx extension create --manifests --rev-version
    • --manifests 标志用于指定清单的文件名,例如vss-extension.json
    • --rev-version 标志将自动增加包的补丁号.
  1. Navigate to the root directory of your extension.
  2. tfx extension create --manifests <manifest-file-name> --rev-version
    • --manifests flag is used for specifying the filename of your manifest, e.g. vss-extension.json
    • --rev-version flag will automatically increment the patch number of your package.

发布(安装/更新)您的扩展程序

使用 publish 命令安装/更新(它会确定需要完成哪些操作)您的扩展.

Publish (install/update) your extension

Use the publish command to install/update (it'll figure out which needs to be done) your extension.

tfx 扩展发布 --service-url

您需要在此处再次指定服务 URL.如果您不这样做,tfx 将尝试将您的扩展发布到 VSS 市场.

You need to specify the service URL again here. If you don't, tfx will attempt to publish your extension to the VSS marketplace.

最后,我喜欢的脚本:

rm *.vsix &&    # Remove old packages
tfx extension create --manifests <manifest-file-name> --rev-version &&
tfx extension publish --service-url <tfs-url>

这篇关于如何使用 tfs-cli (tfx) 更新本地 TFS 实例的 TFS 扩展?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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