tfs 2018通过c#上传过程模板

Tfs 2018 upload process template through c#

我想通过 C# 代码将自定义过程模板(zip 文件)上传到 TFS 我一直在搜索文档,但找不到任何合适的方法,或者更确切地说,找不到任何从纯 c# 来完成的方法代码(我宁愿不使用 power shell 脚本)我使用应该上传流程模板的内置方法,但它不起作用!

感谢转发!

是的,可以编写 c# 程序在控制台中执行 witadmin.exe 所需的参数并上传进程配置文件。关于 witadmin,您可以在这里找到信息:Import and export process configuration. How run witadmin.exe from c# code you can find information here: Run an exe from C# code

IProcessTemplates.AddUpdateTemplate():
name: get it from the ProcessTemplate.xml
description: same
metadata: the OuterXml node of the metadata node
state: "Visible"
zipFileName: I prefer the full path to the zip file.

使用 GetService<<T>T>() 方法从 TfsTeamProjectCollection 实例获取 IProcessTemplates 实例。