@@ -562,8 +562,14 @@ private static void GetTFSFile(string sServer, string sPath, string sLocalPath)
562562 System . Reflection . BindingFlags getmethodflags = System . Reflection . BindingFlags . Public | System . Reflection . BindingFlags . InvokeMethod | System . Reflection . BindingFlags . DeclaredOnly | System . Reflection . BindingFlags . Instance ;
563563 System . Reflection . Assembly tfsAssembly = System . Reflection . Assembly . Load ( TFS_ASSEMBLY_FULL_NAME ) ;
564564 System . Reflection . Assembly tfsVersionControlAssembly = System . Reflection . Assembly . Load ( TFS_VERSION_CONTROL_ASSEMBLY_FULL_NAME ) ;
565+ System . IServiceProvider server = null ;
566+ #if VS2017
567+ Type typeFactory = tfsAssembly . GetType ( "Microsoft.TeamFoundation.Client.TfsTeamProjectCollectionFactory" ) ;
568+ server = ( System . IServiceProvider ) typeFactory . InvokeMember ( "GetTeamProjectCollection" , getmethodflags | System . Reflection . BindingFlags . Static , null , null , new object [ ] { new Uri ( sServer ) } ) ;
569+ #else
565570 Type typeFactory = tfsAssembly . GetType ( "Microsoft.TeamFoundation.Client.TeamFoundationServerFactory" ) ;
566- System . IServiceProvider server = ( System . IServiceProvider ) typeFactory . InvokeMember ( "GetServer" , getmethodflags | System . Reflection . BindingFlags . Static , null , null , new object [ ] { sServer } ) ;
571+ server = ( System . IServiceProvider ) typeFactory . InvokeMember ( "GetServer" , getmethodflags | System . Reflection . BindingFlags . Static , null , null , new object [ ] { sServer } ) ;
572+ #endif
567573 object versionControl = server . GetService ( tfsVersionControlAssembly . GetType ( "Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer" ) ) ;
568574
569575 Type typeVersionSpec = tfsVersionControlAssembly . GetType ( "Microsoft.TeamFoundation.VersionControl.Client.VersionSpec" ) ;
@@ -591,8 +597,14 @@ private static string[] GetTFSVersions(string sServer, string sPath)
591597 System . Reflection . BindingFlags getmethodflags = System . Reflection . BindingFlags . Public | System . Reflection . BindingFlags . InvokeMethod | System . Reflection . BindingFlags . DeclaredOnly | System . Reflection . BindingFlags . Instance ;
592598 System . Reflection . Assembly tfsAssembly = System . Reflection . Assembly . Load ( TFS_ASSEMBLY_FULL_NAME ) ;
593599 System . Reflection . Assembly tfsVersionControlAssembly = System . Reflection . Assembly . Load ( TFS_VERSION_CONTROL_ASSEMBLY_FULL_NAME ) ;
600+ System . IServiceProvider server = null ;
601+ #if VS2017
602+ Type typeFactory = tfsAssembly . GetType ( "Microsoft.TeamFoundation.Client.TfsTeamProjectCollectionFactory" ) ;
603+ server = ( System . IServiceProvider ) typeFactory . InvokeMember ( "GetTeamProjectCollection" , getmethodflags | System . Reflection . BindingFlags . Static , null , null , new object [ ] { new Uri ( sServer ) } ) ;
604+ #else
594605 Type typeFactory = tfsAssembly . GetType ( "Microsoft.TeamFoundation.Client.TeamFoundationServerFactory" ) ;
595- System . IServiceProvider server = ( System . IServiceProvider ) typeFactory . InvokeMember ( "GetServer" , getmethodflags | System . Reflection . BindingFlags . Static , null , null , new object [ ] { sServer } ) ;
606+ server = ( System . IServiceProvider ) typeFactory . InvokeMember ( "GetServer" , getmethodflags | System . Reflection . BindingFlags . Static , null , null , new object [ ] { sServer } ) ;
607+ #endif
596608 object versionControl = server . GetService ( tfsVersionControlAssembly . GetType ( "Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer" ) ) ;
597609
598610 int iVersion = - 1 ;
@@ -618,7 +630,7 @@ private static string[] GetTFSVersions(string sServer, string sPath)
618630 }
619631 return list . ToArray ( ) ;
620632 }
621- #endregion
633+ #endregion
622634
623635 private void PrepXmlForDiff ( string sFilename , string sXSL , bool bNewLineOnAttributes )
624636 {
0 commit comments