Why TFS Build Step Extension Icon Is Missing?

廉价感情. 提交于 2019-12-22 05:14:45

问题


I created a new extension for TFS following MS tutorial. For some reason when I'm adding Icon to my extension I can see this icon when I'm installing the extension and in the "Extension Manager" page,

But when I choose my extension from the build step menu the image is missing.

In the "vss-extension.json" file I added:

"icons": {
    "default": "images/icon.png"
}, 
"files": [
    {
        "path": "images",
        "addressable": true          
    },
    {
        "path": "dist",
        "addressable": true,
        "packagePath": "scripts"
    },
    {
        "path": "infoTab.html",
        "addressable": true
    },                   
    {
        "path": "node_modules/vss-web-extension-sdk/lib",
        "addressable": true,
        "packagePath": "lib"
    },    
    {
        "path": "buildtask"
    }       
],

The image file is 32x32

Should this image be reference in the "task.json" file as well?


回答1:


The task itself has its own icon and it must be stored in the same directory as the task.json and must be called icon.png and be 32x32 pixels and optionally an additional icon.svg can be put alongside it. This has to do with the fact that one extension can contain multiple build tasks, each build task then has its own icon. It's not referenced from the task.json, the correct file name will cause it to be picked up.

For an example, check my Azure Pipelines Snyk task. Also, if this is your complete extension manifest, then it's missing the Build task contribution point:

"contributions": [
{
  "id": "buildtask",
  "type": "ms.vss-distributed-task.task",
  "targets": [
    "ms.vss-distributed-task.tasks"
  ],
  "properties": {
    "name": "buildtask"
  }
}



回答2:


The accepted answer is not correct for Microsoft Visual Studio Team Foundation Server version 15.105.25910.0. Perhaps it was correct for previous versions.

  1. The image file must be named icon.png.
  2. The image file must be in the same folder as task.json.
  3. The image file should be 32 x 32; no image scaling is applied.

The task.json file does not contain any reference to this file. It is located by using these conventions.



来源:https://stackoverflow.com/questions/42050550/why-tfs-build-step-extension-icon-is-missing

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