私は実際に次のコードを使用:
static void GetProjectTemplate()
{
string collectionName = "http://<our_host_name>:8080/tfs/defaultcollection/";
TfsTeamProjectCollection tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(collectionName)
, new UICredentialsProvider());
tfs.EnsureAuthenticated();
ICommonStructureService css = (ICommonStructureService)tfs.GetService(typeof(ICommonStructureService));
string[] projects = { "proj1", "proj2", "proj3" };
foreach (string proj in projects)
{
ProjectInfo projectInfo = css.GetProjectFromName(proj);
String projectName;
String prjState;
int templateId = 0;
ProjectProperty[] projectProperties;
css.GetProjectProperties(
projectInfo.Uri, out projectName, out prjState, out templateId, out projectProperties);
Console.WriteLine(templateId);
}
// Locate templateId in the list of Process templates
IProcessTemplates processTemplates = (IProcessTemplates)tfs.GetService(typeof(IProcessTemplates));
XmlNode node = processTemplates.GetTemplateNames();
Console.WriteLine(Regex.Replace(node.InnerXml,"<[A-Za-z]","\n$&", RegexOptions.ECMAScript));
}
...ここからコピーして変更:http://www.databaseforum.info/30/1083827.aspx
問題は、私はまだ取得 '-1' テンプレートIDとして、です。これは、プロジェクトがテンプレートなしで作成されたことを意味しますか?また、上記のプロジェクトとホスト名をここで変更しました。 (彼らは正当なプロジェクトです)。