How do I use the tfs-cli (tfx) to update a TFS extension for an on-premise TFS instance?

浪子不回头ぞ 提交于 2019-12-09 22:44:40

问题


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.


回答1:


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:

Generate a personal access token

You can follow the instructions here. Or:

  1. Hover over your profile picture in the upper right corner.
  2. Select "Security".
  3. Select the "Personal access tokens" section if not already selected.
  4. Click the "Add" button to generate a new token.
  5. If you'd like to limit the scope, select just the "Marketplace (publish)" option.
  6. Click "Create token".
  7. Copy it and keep it somewhere safe!

Login

Enter the following in the commandline:

tfx login

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

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

  • http://tfs.company.domain:8080/tfs/
  • https://tfs.company.domain/tfs/
  • https://tfs.company.domain/

Some things to watch out for:

  1. Specify http/https.
  2. You may/may not need to specify the port number.
  3. Depending on what version of TFS 2017 you're running and how it was installed, you may or may not need to include /tfs/ in the URL. For example, it's possible to get rid of the /tfs/ virtual directory when installing. Look at the URL you use when you use TFS in your browser and your command accordingly.

Package your extension

  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 (install/update) your extension

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

tfx extension publish --service-url <tfs-url>

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

Lastly, my preferred script:

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


来源:https://stackoverflow.com/questions/44853350/how-do-i-use-the-tfs-cli-tfx-to-update-a-tfs-extension-for-an-on-premise-tfs-i

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!