TfsConfigurationServer.GetService() always returns null

前端 未结 1 1202
暗喜
暗喜 2021-01-12 07:34

I\'m trying to connect to TFS 2010 using TFS SDK, but can\'t get VersionControlServer service.

var servers = RegisteredTfsConnections.GetConfigurationServers         


        
相关标签:
1条回答
  • 2021-01-12 08:20

    You don't want the configuration server, you want the project collection. The version control service is scoped to a team project collection. For example:

    var projectCollection =
        TfsTeamProjectCollectionFactory.GetTeamProjectCollection(registeredProjectCollection);
    
    var versionControl = projectCollection.GetService<VersionControlServer>();
    

    See also: Connect to a Project Collection

    0 讨论(0)
提交回复
热议问题