Cls
# Здесь указать Uri к TFS коллекции
$srv='http://tfs:8080/tfs/CollectionName'
$Assem = (
"Microsoft.TeamFoundation.Client, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" ,
"Microsoft.TeamFoundation.Common, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
)
$Source = @"
using System;
using System.Collections.Generic;
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.Server;
using Microsoft.TeamFoundation.Common;
using System.Text;
namespace LP
{
public class Program
{
public Program()
{
}
public void Get(string url)
{
TfsTeamProjectCollection tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri (url));
ICommonStructureService css = (ICommonStructureService)tfs.GetService(typeof(ICommonStructureService));
List<string> list = new List<string>();
foreach (ProjectInfo projectInfo in css.ListAllProjects())
{
list.Add(projectInfo.Name);
}
list.Sort();
foreach (string value in list)
{
//Console.Write("'");
Console.WriteLine(value);
//Console.Write("',");
}
}
}
}
"@
Add-Type -ReferencedAssemblies $Assem -TypeDefinition $Source -Language CSharp
$LT = New-Object LP.Program
$LT.Get($srv)
# Здесь указать Uri к TFS коллекции
$srv='http://tfs:8080/tfs/CollectionName'
$Assem = (
"Microsoft.TeamFoundation.Client, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" ,
"Microsoft.TeamFoundation.Common, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
)
$Source = @"
using System;
using System.Collections.Generic;
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.Server;
using Microsoft.TeamFoundation.Common;
using System.Text;
namespace LP
{
public class Program
{
public Program()
{
}
public void Get(string url)
{
TfsTeamProjectCollection tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri (url));
ICommonStructureService css = (ICommonStructureService)tfs.GetService(typeof(ICommonStructureService));
List<string> list = new List<string>();
foreach (ProjectInfo projectInfo in css.ListAllProjects())
{
list.Add(projectInfo.Name);
}
list.Sort();
foreach (string value in list)
{
//Console.Write("'");
Console.WriteLine(value);
//Console.Write("',");
}
}
}
}
"@
Add-Type -ReferencedAssemblies $Assem -TypeDefinition $Source -Language CSharp
$LT = New-Object LP.Program
$LT.Get($srv)
Комментариев нет:
Отправить комментарий