@@ -242,7 +242,7 @@ private bool SwitchVsixManifest()
242242 {
243243#if SQL2019
244244 string sVersion = VersionInfo . SqlServerVersion . ToString ( ) ;
245- if ( sVersion . StartsWith ( "14." ) ) //this DLL is for SQL 2019 but you have SSDT for SQL2017 installed
245+ if ( sVersion . StartsWith ( "14." ) ) //this BI Dev Extensions DLL is for SQL 2019 but you have SSDT for SQL2017 installed
246246 {
247247 string sFolder = System . IO . Directory . GetParent ( Assembly . GetExecutingAssembly ( ) . Location ) . FullName ;
248248 string sManifestPath = sFolder + "\\ extension.vsixmanifest" ;
@@ -254,7 +254,7 @@ private bool SwitchVsixManifest()
254254 string sPkgdef2017Path = sFolder + "\\ BidsHelper2017.pkgdef" ;
255255 string sPkgdef2017BackupPath = sFolder + "\\ BidsHelper2017.pkgdef.bak" ;
256256
257- //// string sDll2017Path = sFolder + "\\SQL2016 \\BidsHelper2017.dll";
257+ string sDll2017Path = sFolder + "\\ SQL2017 \\ BidsHelper2017.dll" ;
258258
259259 if ( System . IO . File . Exists ( sOtherManifestPath ) && System . IO . File . Exists ( sPkgdef2017BackupPath ) && System . IO . File . Exists ( sPkgdef2019Path ) )
260260 {
@@ -276,13 +276,16 @@ private bool SwitchVsixManifest()
276276
277277
278278
279- ////////it looks like some earlier versions of VS2015 use the registry while newer versions of VS2015 (like Update 3) just use the vsixmanifest and pkgdef files?
280- //////Microsoft.Win32.RegistryKey regKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\VisualStudio\14.0_Config\Packages\{" + PackageGuidString +"}", true);
281- //////if (regKey != null)
282- //////{
283- ////// regKey.SetValue("CodeBase", sDll2017Path, Microsoft.Win32.RegistryValueKind.String);
284- ////// regKey.Close();
285- //////}
279+ //VS2017 seems to use the registry after the first run to denote which DLL to launch
280+ //the 15.0* hive is special in that it is actually "C:\Users\<user>\AppData\Local\Microsoft\VisualStudio\15.0_31028247\privateregistry.bin"
281+ //if you want to view this in regedit then close all VS2017 and go to HKEY_LOCAL_MACHINE... File... Load Hive... choose that privateregistry.bin
282+ //remember to click on the new hive folder and do File... Unload Hive before trying to open VS2017
283+ Microsoft . Win32 . RegistryKey regKey = Microsoft . Win32 . Registry . CurrentUser . OpenSubKey ( @"Software\Microsoft\VisualStudio\15.0_Config\Packages\{" + PackageGuidString + "}" , true ) ;
284+ if ( regKey != null )
285+ {
286+ regKey . SetValue ( "CodeBase" , sDll2017Path , Microsoft . Win32 . RegistryValueKind . String ) ;
287+ regKey . Close ( ) ;
288+ }
286289
287290 System . Windows . Forms . MessageBox . Show ( "You have SSDT for SQL Server " + VersionInfo . SqlServerFriendlyVersion + " installed. Please restart Visual Studio so BIDS Helper can reconfigure itself to work properly with that version of SSDT." , "BIDS Helper" ) ;
288291 return true ;
@@ -296,7 +299,7 @@ private bool SwitchVsixManifest()
296299 string sVersion = VersionInfo . SqlServerVersion . ToString ( ) ;
297300 if ( sVersion . StartsWith ( "15." ) ) //this BI Dev Extensions DLL is for SQL 2017 but you have SSDT for SQL2019 installed
298301 {
299- string sFolder = System . IO . Directory . GetParent ( Assembly . GetExecutingAssembly ( ) . Location ) . FullName ;
302+ string sFolder = System . IO . Directory . GetParent ( System . IO . Directory . GetParent ( Assembly . GetExecutingAssembly ( ) . Location ) . FullName ) . FullName ;
300303 string sManifestPath = sFolder + "\\ extension.vsixmanifest" ;
301304 string sBackupManifestPath = sFolder + "\\ extension2017.vsixmanifest" ;
302305 string sOtherManifestPath = sFolder + "\\ extension2019.vsixmanifest" ;
@@ -306,7 +309,7 @@ private bool SwitchVsixManifest()
306309 string sPkgdef2017Path = sFolder + "\\ BidsHelper2017.pkgdef" ;
307310 string sPkgdef2017BackupPath = sFolder + "\\ BidsHelper2017.pkgdef.bak" ;
308311
309- //// string sDll2017Path = sFolder + "\\SQL2017\\BidsHelper2017 .dll";
312+ string sDll2019Path = sFolder + "\\ BidsHelper2019 .dll" ;
310313
311314 if ( System . IO . File . Exists ( sOtherManifestPath ) && System . IO . File . Exists ( sPkgdef2019BackupPath ) && System . IO . File . Exists ( sPkgdef2017Path ) )
312315 {
@@ -326,13 +329,16 @@ private bool SwitchVsixManifest()
326329 else
327330 System . IO . File . Move ( sPkgdef2017Path , sPkgdef2017BackupPath ) ;
328331
329- ////////it looks like some earlier versions of VS2015 use the registry while newer versions of VS2015 (like Update 3) just use the vsixmanifest and pkgdef files?
330- //////Microsoft.Win32.RegistryKey regKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\VisualStudio\14.0_Config\Packages\{" + PackageGuidString +"}", true);
331- //////if (regKey != null)
332- //////{
333- ////// regKey.SetValue("CodeBase", sDll2017Path, Microsoft.Win32.RegistryValueKind.String);
334- ////// regKey.Close();
335- //////}
332+ //VS2017 seems to use the registry after the first run to denote which DLL to launch
333+ //the 15.0* hive is special in that it is actually "C:\Users\<user>\AppData\Local\Microsoft\VisualStudio\15.0_31028247\privateregistry.bin"
334+ //if you want to view this in regedit then close all VS2017 and go to HKEY_LOCAL_MACHINE... File... Load Hive... choose that privateregistry.bin
335+ //remember to click on the new hive folder and do File... Unload Hive before trying to open VS2017
336+ Microsoft . Win32 . RegistryKey regKey = Microsoft . Win32 . Registry . CurrentUser . OpenSubKey ( @"Software\Microsoft\VisualStudio\15.0_Config\Packages\{" + PackageGuidString + "}" , true ) ;
337+ if ( regKey != null )
338+ {
339+ regKey . SetValue ( "CodeBase" , sDll2019Path , Microsoft . Win32 . RegistryValueKind . String ) ;
340+ regKey . Close ( ) ;
341+ }
336342
337343 System . Windows . Forms . MessageBox . Show ( "You have SSDT for SQL Server " + VersionInfo . SqlServerFriendlyVersion + " installed. Please restart Visual Studio so BIDS Helper can reconfigure itself to work properly with that version of SSDT." , "BIDS Helper" ) ;
338344 return true ;
0 commit comments