对于VSTS/TFS 2015,我使用.NET Client Libraries以编程方式创建基于我在另一个团队项目中抓取的模板的构建定义。使用TFS 2015 .NET客户端库从模板创建构建定义
我可以用得到的构建定义模板(2.0):
BuildDefinitionTemplate builddeftemplate = buildHttpClient.GetTemplateAsync(teamProject, templateId).Result;
,我还可以通过使用创建构建定义:
BuildDefinition builddef = new BuildDefinition();
builddef.Project = newTeamProject;
但看起来并不像一个办法作为构建定义的属性传递模板,也不从模板创建构建定义。
当为REST API的文件看,该GET请求实际上就是返回大量的JSON:
{
"id": "vsBuild",
"name": "Visual Studio",
"canDelete": false,
"category": "Build",
"iconTaskId": "71a9a2d3-a98a-4caa-96ab-affca411ecda",
"description": "Build and run tests using Visual Studio. This template requires that Visual Studio be installed on the build agent.",
"template": {
"build": [
{
"enabled": true,
"continueOnError": false,
"alwaysRun": false,
"task": {
"id": "71a9a2d3-a98a-4caa-96ab-affca411ecda",
"versionSpec": "*"
},
"inputs": {
"solution": "**\\*.sln",
"msbuildLocation": "",
"vsLocation": "",
"msbuildArgs": "",
"platform": "$(BuildPlatform)",
"configuration": "$(BuildConfiguration)",
"clean": "false"
}
},
...
所以,我认为有可能返回的模板只抢零件作为JSON对象,并通过构建定义的POST与这些部分进行通信,但似乎只能是REST API路由。
这是可能与.NET客户端库吗?还是有更简单的方法,我可能错过了?
什么是你想创建构建定义的构建的类型? vNext或XAML? –
vNext。我认为帕特里克(下图)能够提供解决方案,但挑战肯定是对旧团队项目的引用,它会导致问题创建构建定义,但这对于将来的REST API肯定会是一个惊人的补充。 – Sachi