问题描述
我需要创建 Team Foundation Server 项目,但我能找到的唯一方法是通过网站手动创建.
是否可以通过 CLI、编程语言或 RESTful API 以编程方式进行操作?
提前致谢.
这是可能的,您可以使用 Rest API 做到这一点.Azure Devops Server 2019
和 TFS 2018U2
都支持使用 Rest API 创建项目.
另外:这是一个类似问题,可使用 CLI 实现您想要的.这是另一个,如果您想使用 C# 代码执行此操作,它可能会给您一些提示.
希望以上都能帮到你:)
I need to create Team Foundation Server projects, but the only way I can find to do it is manually through the website.
Is it possible to do programmatically via a CLI, programming language, or RESTful API?
Thanks in advance.
It's possible, you can do that using Rest API. Azure Devops Server 2019
and TFS 2018U2
both support creating project using Rest API. TFS2018U2, Azure Devops Server.
More details please refer to this document.
Test with TFS2018U2
in PostMan:
Request URL: https://ServerName:8080/tfs/CollectionName/_apis/projects?api-version=4.1
Request Body:
{
"name": "CreateProjectTest",
"description": "Just for Test",
"capabilities": {
"versioncontrol": {
"sourceControlType": "Git"
},
"processTemplate": {
"templateTypeId": "6b724908-ef14-45cf-84f8-768b5384da45"
}
}
}
If you get status 202 accepted
, then you can see the newly created project in website after some time (For me,10~25 seconds).
Note: The document states the format is https://{instance}/{collection}/_apis/projects?api-version=xxx
, but you need to use http
instead of https
when you Public URL starts with http
:
In addition: Here's one similar issue to achieve what you want using CLI. And here's another one that may give you some hint if you want to do that using C# code.
Hope all above helps :)
这篇关于可以以编程方式创建 Team Foundation Server 项目吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!