本文介绍了VS402881:没有指定与工件源"MyBuild"相对应的工件版本.版本管理vNext REST API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用TFS 2015.2 RTM,我刚刚发现Release Management vNext REST API位于内部2.2-preview.1中.我想创建一个发行版,但是由于文档仅适用于VSTS.

I'm using TFS 2015.2 RTM and I just found out that the Release Management vNext REST API is in 2.2-preview.1 on-premises. I want to create a release, but I don't know the exact JSON to put in the body of the POST request since the documentation only works for VSTS.

我发送请求时,收到错误消息:

When I send the request, I get the error message:

VS402881: No artifact version is specified corresponding to artifact source 'MyBuild.' Specify a valid value and try again. 

这是JSON:

$body = @"
     {
          definitionId": 1,
    "description": "test",
    "artifacts": [ 
      {
         "alias": "Tailspin Toys", 
         "version": {
               "id": 147,
         },
         "instanceReference": {
            "id": 5
        }
       }
     ]
} 
"@

这是Invoke-RestMethod命令:

And here's the Invoke-RestMethod command:

$releaseResponse = Invoke-RestMethod -Method Post -Credential $credential -ContentType application/json -Uri $postUri -Body $body

我缺少哪些JSON项?如果文档没有缺少的内容,如何找到要放在JSON正文中的内容?

What JSON items am I missing? How do I find what to put in the JSON body if the docs don't have what is missing?

推荐答案

是的,当前版本的VSTS API与TFS 2015.2 API之间存在一些差异.但是,除了少数几个API之外,大多数API都应该可以使用.这是文档链接.

Yes there are some disparities between the current version of VSTS APIs and the TFS 2015.2 APIs. But most of the APIs should work except a very few. Here is the documentation link.

以下是创建版本所需的JSON.必需的JSON需要在instanceReference中具有name,尽管它对于VSTS API的当前版本是可选的.

Following is the required JSON for creating a release.The required JSON needs to have the name in instanceReference although its optional for the current version of VSTS API.

{
  "definitionId": 1,
  "description": "test",
  "artifacts": [
    {
      "alias": "Tailspin Toys",
      "instanceReference": {
        "id": "5",
        "name": "<build_name>"
      }
    }
  ]
}

这篇关于VS402881:没有指定与工件源"MyBuild"相对应的工件版本.版本管理vNext REST API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 23:07