Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从C#.net代码访问TFS中的源代码管理资源管理器_C#_.net_Tfs_Source Control Explorer - Fatal编程技术网

从C#.net代码访问TFS中的源代码管理资源管理器

从C#.net代码访问TFS中的源代码管理资源管理器,c#,.net,tfs,source-control-explorer,C#,.net,Tfs,Source Control Explorer,下面是我为访问项目和团队而编写的代码,但它显示了一些错误。我想访问项目,然后访问项目/团队中源代码管理资源管理器中的源代码 Uri _serverUri = new Uri("MyURI"); string _teamProjectName = "MyProject"; TfsTeamProjectCollection collection = TfsTeamProjectCollectio

下面是我为访问项目和团队而编写的代码,但它显示了一些错误。我想访问项目,然后访问项目/团队中源代码管理资源管理器中的源代码

            Uri _serverUri = new Uri("MyURI");
            string _teamProjectName = "MyProject";

            TfsTeamProjectCollection collection =
                TfsTeamProjectCollectionFactory.GetTeamProjectCollection(_serverUri);

            // Retrieve the project URI. Needed to enumerate teams.
            var css4 = collection.GetService<ICommonStructureService>();
            ProjectInfo projectInfo = css4.GetProjectFromName(_teamProjectName);

            // Retrieve a list of all teams on the project.
            TfsTeamService teamService = collection.GetService<TfsTeamService>();
            var allTeams = teamService.QueryTeams(projectInfo.Uri);
            allTeams.ToList().ForEach
            (
            allteams => { Console.WriteLine(allteams); });
Uri\u serverUri=新的Uri(“MyURI”);
字符串_teamProjectName=“MyProject”;
TFT项目集合=
tfstreamprojectcollectionfactory.GetTeamProjectCollection(\u serverUri);
//检索项目URI。需要枚举团队。
var css4=collection.GetService();
ProjectInfo ProjectInfo=css4.GetProjectFromName(_teamProjectName);
//检索项目中所有团队的列表。
TfsTeamService teamService=collection.GetService();
var allTeams=teamService.QueryTeams(projectInfo.Uri);
allTeams.ToList().ForEach
(
allteams=>{Console.WriteLine(allteams);});
它显示的错误是“名称空间Microsoft.TeamFoundation.Server中不存在类型或名称空间'Core'


我还想访问源代码管理,因此如果有人可以帮助我解决这两个问题。

您可以删除using指令“Microsoft.TeamFoundation.Server.Core”@Oswald谢谢,这解决了问题,但您仍然可以帮助我访问源代码管理吗??