TFS 2015 Rest API - 创建构建定义

时间:2018-01-02 19:40:21

标签: rest api asp.net-web-api tfsbuild tfs2015

我正在尝试使用他的api rest在TFS中创建一个构建定义。

This is the microsoft docs for TFS Api Rest

我获得状态代码200但是......

This is what i get when I look into Tfs build definition

任何人都知道为什么会这样?

1 个答案:

答案 0 :(得分:0)

您的第二个链接提供了一个没有任务的构建定义的屏幕截图。您似乎已成功创建了构建定义,但未在构建定义中添加任务。

检查您的其余API,看看您的"build": []参数是否包含"task",如下例所示:

 "build": [
    {
      "enabled": true,
      "continueOnError": false,
      "alwaysRun": false,
      "displayName": "Build solution **\\*.sln",
      "task": {
        "id": "71a9a2d3-a98a-4caa-96ab-affca411ecda",
        "versionSpec": "*"
      },
      "inputs": {
        "solution": "**\\*.sln",
        "msbuildArgs": "",
        "platform": "$(platform)",
        "configuration": "$(config)",
        "clean": "false",
        "restoreNugetPackages": "true",
        "vsLocationMethod": "version",
        "vsVersion": "latest",
        "vsLocation": "",
        "msbuildLocationMethod": "version",
        "msbuildVersion": "latest",
        "msbuildArchitecture": "x86",
        "msbuildLocation": "",
        "logProjectEvents": "true"
      }
    },
    {
      "enabled": true,
      "continueOnError": false,
      "alwaysRun": false,
      "displayName": "Test Assemblies **\\*test*.dll;-:**\\obj\\**",
      "task": {
        "id": "ef087383-ee5e-42c7-9a53-ab56c98420f9",
        "versionSpec": "*"
      },
      "inputs": {
        "testAssembly": "**\\*test*.dll;-:**\\obj\\**",
        "testFiltercriteria": "",
        "runSettingsFile": "",
        "codeCoverageEnabled": "true",
        "otherConsoleOptions": "",
        "vsTestVersion": "14.0",
        "pathtoCustomTestAdapters": ""
      }
    }
  ],