可以以编程方式创建 Team Foundation Server 项目吗?
Possible to create Team Foundation Server Project programmatically?
我需要创建 Team Foundation Server 项目,但我能找到的唯一方法是通过网站手动创建。
是否可以通过 CLI、编程语言或 RESTful API 以编程方式进行?
提前致谢。
Is it possible to do programmatically via a CLI, programming language,
or RESTful API?
有可能,您可以使用 Rest API 来做到这一点。 Azure Devops Server 2019
和 TFS 2018U2
都支持使用 Rest 创建项目 API。 TFS2018U2, Azure Devops Server.
更多详情请参考this document。
在 PostMan 中使用 TFS2018U2
进行测试:
请求URL:https://ServerName:8080/tfs/CollectionName/_apis/projects?api-version=4.1
请求正文:
{
"name": "CreateProjectTest",
"description": "Just for Test",
"capabilities": {
"versioncontrol": {
"sourceControlType": "Git"
},
"processTemplate": {
"templateTypeId": "6b724908-ef14-45cf-84f8-768b5384da45"
}
}
}
如果你得到状态202 accepted
,那么你可以在一段时间后(对我来说,10~25秒)在网站上看到新创建的项目。
注意:文档中写明格式是https://{instance}/{collection}/_apis/projects?api-version=xxx
,但是当你Public URL 以 http
:
开头
此外:这里有一个 to achieve what you want using CLI. And here's another one 如果您想使用 C# 代码来做,可能会给您一些提示。
希望以上对您有所帮助:)
我需要创建 Team Foundation Server 项目,但我能找到的唯一方法是通过网站手动创建。
是否可以通过 CLI、编程语言或 RESTful API 以编程方式进行?
提前致谢。
Is it possible to do programmatically via a CLI, programming language, or RESTful API?
有可能,您可以使用 Rest API 来做到这一点。 Azure Devops Server 2019
和 TFS 2018U2
都支持使用 Rest 创建项目 API。 TFS2018U2, Azure Devops Server.
更多详情请参考this document。
在 PostMan 中使用 TFS2018U2
进行测试:
请求URL:https://ServerName:8080/tfs/CollectionName/_apis/projects?api-version=4.1
请求正文:
{
"name": "CreateProjectTest",
"description": "Just for Test",
"capabilities": {
"versioncontrol": {
"sourceControlType": "Git"
},
"processTemplate": {
"templateTypeId": "6b724908-ef14-45cf-84f8-768b5384da45"
}
}
}
如果你得到状态202 accepted
,那么你可以在一段时间后(对我来说,10~25秒)在网站上看到新创建的项目。
注意:文档中写明格式是https://{instance}/{collection}/_apis/projects?api-version=xxx
,但是当你Public URL 以 http
:
此外:这里有一个
希望以上对您有所帮助:)