创建团队项目后如何确定 Team Foundation Server 中使用的流程模板

发布于 2024-07-21 11:37:04 字数 115 浏览 18 评论 0原文

我正在寻找一种方法来确定团队项目创建后使用的流程模板。 我现在只能通过查看工作项类型来猜测。 我在 Visual Studio 中找不到任何选项来检索此信息。 我需要知道哪些流程模板用于非我自己创建的团队项目。

I'm looking for a way to determine what process template was used for a team project after it has been created. I can now only guess by looking at the work item types. I could not find any option in Visual Studio to retrieve this information. I need to know what processs template was used for team projects not created by myself.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

陌若浮生 2024-07-28 11:37:04

如果您检查工作项类型:

  • Scrum = 产品待办事项列表项
  • Agile = 用户故事
  • CMMI = 需求

If you check your work item type:

  • Scrum = Product Backlog Item
  • Agile = User Story
  • CMMI = Requirement
扶醉桌前 2024-07-28 11:37:04

对于 TFS 2010 和 TFS 2012,您可以按照以下流程来确定团队项目使用哪个流程模板:

  1. 转到团队资源管理器;
  2. 打开文档文件夹;
  3. 流程指导;
  4. 打开 ProcessGuidance.html,这将打开您的团队项目所基于的特定流程模板文档。

请参阅线程

For TFS 2010 & TFS 2012, you can follow below process to determine which process template a team project used:

  1. Go to Team Explorer;
  2. Open Documents folder;
  3. Process Guidance;
  4. Open ProcessGuidance.html, this will open specific Process Template documenation that your team project base on.

Refer to thread

格子衫的從容 2024-07-28 11:37:04

一般来说,没有办法说清楚。
如果您创建(或编辑)流程模板,则可以将标识符放入属性中,然后您将能够跟踪哪些项目具有您的模板

要执行此操作:
编辑分类\Classification.xml
添加节点:
任务/任务/taskXml/属性/属性
像这样:

使用此模板创建项目后,在对象模型中,您将能够从中提取此信息一个项目:

TfsTeamProjectCollection c = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(myuri);
WorkItemStore wis = tpc.GetService();
ICommonStructureService ICss = tpc.GetService();

foreach (Project p in wis.Projects)
{
  string ProjectName = string.Empty;
  string ProjectState = String.Empty;
  int templateId = 0;
  ProjectProperty[] ProjectProperties = null;
  ICss.GetProjectProperties(p.Uri.ToString(), out ProjectName, out ProjectState, out templateId, out ProjectProperties);
  Console.WriteLine("Project: {0}\tTemplate: {1}", ProjectName, ProjectProperties.Where(n => n.Name == "templateName").FirstOrDefault().Value);
}

templateId 始终为 -1,所以不要认为这会对您有帮助。

另外 - 如果您有权,我建议将此属性添加到您集合中的所有模板(甚至是默认模板)中,以便您能够跟踪所有未来项目的模板。 不知道为什么他们没有将其放入默认模板中。 (如果有足够多的人抱怨也许他们会)

There is no way to tell, in general.
If you create (or edit) a process template, you can put an identifier into a property then you will be able to track which projects have your template(s)

To do this:
Edit Classification\Classification.xml
add a node:
tasks/task/taskXml/properties/property
like this:

<property name="templateName" value="myTemplate_1.0.1" />

Once you have projects created with this template, in the object model you will be able to pull this info from a project:

TfsTeamProjectCollection c = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(myuri);
WorkItemStore wis = tpc.GetService();
ICommonStructureService ICss = tpc.GetService();

foreach (Project p in wis.Projects)
{
  string ProjectName = string.Empty;
  string ProjectState = String.Empty;
  int templateId = 0;
  ProjectProperty[] ProjectProperties = null;
  ICss.GetProjectProperties(p.Uri.ToString(), out ProjectName, out ProjectState, out templateId, out ProjectProperties);
  Console.WriteLine("Project: {0}\tTemplate: {1}", ProjectName, ProjectProperties.Where(n => n.Name == "templateName").FirstOrDefault().Value);
}

templateId is always -1 so dont think that will help you.

Also - If you have the rights to, I recommend adding this property into all the templates (even the default templates) in your collection, so that you will be able to track the templates of all future projects. Don't know why they didn't put it in the default templates. (if enough people complain maybe they will)

豆芽 2024-07-28 11:37:04

我找到了另一种解决方法:在 SharePoint 管理中心中,您可以在网站集列表中看到描述所使用的流程模板的注释。 我实际上正在寻找一种通过 TFS API 以编程方式检索它的方法,但找不到它。

I found another workaround: in SharePoint Central Administration you can see in the Site Collection list a comment that described the process template that was used. I was actually looking for a way to programatically retrieve it via the TFS API, but could not find it.

浅沫记忆 2024-07-28 11:37:04

使用witadmin,您可以列出项目中的工作项类型。 /collection 参数是 TPC url,/p 参数是项目名称。 这是一个例子(如下)。 如果您知道特定于流程模板的工作项类型的名称,那么您就知道正在使用哪个流程模板。

我的测试 TFS 命令控制台的输出:

D:\Program Files\Microsoft Team Foundation Server 2010\Tools>witadmin listwitd /collection:http://suluserver:8080/tfs/De
faultCollection /p:"First Team Project"
Bug
Shared Steps
Task
Test Case
User Story
Issue
Risk
User Scenario
Risk-Issue

Using witadmin, you can list the work item types in the project. The /collection parameter is the TPC url and the /p parameter is the project name. Here is an example (below). If you know the name of a work item type that is specific to a process template, then you know which process template is being used.

Output of command console from my test TFS:

D:\Program Files\Microsoft Team Foundation Server 2010\Tools>witadmin listwitd /collection:http://suluserver:8080/tfs/De
faultCollection /p:"First Team Project"
Bug
Shared Steps
Task
Test Case
User Story
Issue
Risk
User Scenario
Risk-Issue
野味少女 2024-07-28 11:37:04

对于在线视觉工作室,请转到您的收藏简介页面。 您可以查看集合中的所有项目,包括流程模板信息。

您的收藏页面的 URL 格式应为:
https://[accountname].visualstudio.com/[collectionname]/_admin

For visual studio online, go to your collection profile page. You can see all the projects inside your collection including the process template information.

The URL format to your collection page should be:
https://[accountname].visualstudio.com/[collectionname]/_admin

柠北森屋 2024-07-28 11:37:04

我不知道找到这个问题的万无一失的方法。

我推荐以下内容: 有一个名为 witexport.exe 的 exe,可以导出工作项的 xml。 然后您可以查看 xml 以查看使用了哪种模板。 (即,如果使用 conchango 模板,您将看到对其的引用。)

要运行它,请启动 VS 命令行提示符(在开始菜单中)。 以下是运行示例:

witexport /f "C:\Type.xml" /t "http:\MyServer:8080" /p MyProject /n "Sprint BackLog Item"

I don't know a fail proof way to find this out.

I would recommend the following: There is a exe called witexport.exe that can export the xml of a work item. You can then look through the xml to see what kind of template was used. (ie if the conchango template is used you will see references to it.)

To run it fire up the VS Command line prompt (in the start menu). Here is an example run:

witexport /f "C:\Type.xml" /t "http:\MyServer:8080" /p MyProject /n "Sprint BackLog Item"

一杯敬自由 2024-07-28 11:37:04

PowerShell 和 REST API

这是一个 PowerShell 脚本,用于从本地 DevOps 服务器(适用于 Server 2022)获取项目及其流程模板的列表。

它将在控制台中显示项目,并将结果保存到 txt 或 csv 文件。

# Run this PowerShell script on your DevOps Server (on prem) from an account with DevOps admin access
# Update $collectionUrl below

$collectionUrl = "https://MyDevopsServer/MyCollection/"

# API REST call to get the list of projects in the collection
$projects = Invoke-RestMethod -Uri "$collectionUrl/_apis/projects" -Method Get -UseDefaultCredentials -ContentType application/json    

Write-Host "Src Ctrl  ProcTemplate  Project"
Write-Host "--------  ------------  -------"

# Loop through each project and save properties to $Output
$Output = foreach($project in $projects.value | Sort-Object name)
{
    $teamProject = $project.name;
    $projectInfoUrl = $project.url + "?includeCapabilities=true";
    
    # API REST call to get the project's capabilities
    $projectInfo = Invoke-RestMethod -Uri "$projectInfoUrl" -Method Get -UseDefaultCredentials -ContentType application/json

    $sourceControlType = $projectInfo.capabilities.versioncontrol.sourceControlType;
    $templateName = if ($projectInfo.capabilities.processTemplate.templateName) {$projectInfo.capabilities.processTemplate.templateName} else {'  '};

    Write-Host $sourceControlType `t`t $templateName `t`t $teamProject
    
    # Create an object to save properties and append to $Output
    New-Object -TypeName PSObject -Property @{
        TeamProject = $teamProject
        SourceControlType = $sourceControlType
        TemplateName = $templateName 
    } | Select-Object TeamProject,SourceControlType,TemplateName
}

#Write to CSV or TXT file
$txtFile = $PSScriptRoot + "\ProjectList.txt"
$csvFile = $PSScriptRoot + "\ProjectList.csv"
$Output | Out-File $txtFile
#$Output | Export-Csv $csvFile

您还可以从 Postman/curl 手动调用 REST 方法:

  • 项目:GET https://MyDevopsServer/MyCollection/_apis/projects
  • 项目详细信息:GET https://MyDevopsServer/MyCollection/_apis /projects//<>?includeCapability=true

确保添加 Basic Auth 类型的授权标头,其中包含空白 用户名密码中的有效 PAT 令牌。

PowerShell & REST API

Here's a PowerShell script to get the list of Projects and their Process templates from an on-prem DevOps Server (works on Server 2022).

It will display the projects in the console and also save the results to a txt or csv file.

# Run this PowerShell script on your DevOps Server (on prem) from an account with DevOps admin access
# Update $collectionUrl below

$collectionUrl = "https://MyDevopsServer/MyCollection/"

# API REST call to get the list of projects in the collection
$projects = Invoke-RestMethod -Uri "$collectionUrl/_apis/projects" -Method Get -UseDefaultCredentials -ContentType application/json    

Write-Host "Src Ctrl  ProcTemplate  Project"
Write-Host "--------  ------------  -------"

# Loop through each project and save properties to $Output
$Output = foreach($project in $projects.value | Sort-Object name)
{
    $teamProject = $project.name;
    $projectInfoUrl = $project.url + "?includeCapabilities=true";
    
    # API REST call to get the project's capabilities
    $projectInfo = Invoke-RestMethod -Uri "$projectInfoUrl" -Method Get -UseDefaultCredentials -ContentType application/json

    $sourceControlType = $projectInfo.capabilities.versioncontrol.sourceControlType;
    $templateName = if ($projectInfo.capabilities.processTemplate.templateName) {$projectInfo.capabilities.processTemplate.templateName} else {'  '};

    Write-Host $sourceControlType `t`t $templateName `t`t $teamProject
    
    # Create an object to save properties and append to $Output
    New-Object -TypeName PSObject -Property @{
        TeamProject = $teamProject
        SourceControlType = $sourceControlType
        TemplateName = $templateName 
    } | Select-Object TeamProject,SourceControlType,TemplateName
}

#Write to CSV or TXT file
$txtFile = $PSScriptRoot + "\ProjectList.txt"
$csvFile = $PSScriptRoot + "\ProjectList.csv"
$Output | Out-File $txtFile
#$Output | Export-Csv $csvFile

You can also call the REST methods manually from Postman/curl:

  • Projects: GET https://MyDevopsServer/MyCollection/_apis/projects
  • Project details: GET https://MyDevopsServer/MyCollection/_apis/projects//<<ProjectGuid>>?includeCapabilities=true

Make sure to add an authorization header of type Basic Auth with blank username and a valid PAT token in the password.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文