Skip to content

Commit e834271

Browse files
committed
fixing Smart Diff against TFS in VS2017 as the old method was deprecated in the TFS API
1 parent 114da36 commit e834271

4 files changed

Lines changed: 28 additions & 4 deletions

File tree

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@
55
/bin/Debug
66
/obj/Debug
77
/.vs/SQL2017_BidsHelper/v14/.suo
8+
/.vs/SQL2017_VS2017_BidsHelper/v15/sqlite3/storage.ide
9+
/.vs/SQL2017_VS2017_BidsHelper/v15/.suo
10+
/UpgradeLog.htm
11+
/SQL2017_VS2017_BidsHelper.user

SQL2017_VS2017_BidsHelper.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
<WarningLevel>4</WarningLevel>
7373
<CopyVsixExtensionFiles>True</CopyVsixExtensionFiles>
7474
<DeployExtension>True</DeployExtension>
75-
<CopyVsixExtensionLocation>C:\Users\ggalloway\appdata\local\microsoft\VisualStudio\15.0_51708051Exp\Extensions\wz3p0wpo.mvh</CopyVsixExtensionLocation>
75+
<CopyVsixExtensionLocation>C:\Users\ggalloway\AppData\Local\Microsoft\VisualStudio\15.0_31028247Exp\Extensions\Extensions-15.0_31028247\jor1u0ry.qod</CopyVsixExtensionLocation>
7676
<Prefer32Bit>false</Prefer32Bit>
7777
<PlatformTarget>x86</PlatformTarget>
7878
<RunCodeAnalysis>false</RunCodeAnalysis>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
4+
<StartAction>Program</StartAction>
5+
<StartProgram>C:\Program Files %28x86%29\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\devenv.exe</StartProgram>
6+
<StartArguments>/rootsuffix Exp</StartArguments>
7+
</PropertyGroup>
8+
</Project>

SSIS/SmartDiffPlugin.cs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)