Skip to content

Commit 6b4a22e

Browse files
committed
working on BIDS Helper for SQL 2017 in VS2015
1 parent f3e1282 commit 6b4a22e

16 files changed

Lines changed: 369 additions & 18 deletions

BidsHelper2016.pkgdef.bak

4.51 KB
Binary file not shown.

BidsHelperPackage.cs

Lines changed: 122 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ public BIDSHelperPackage()
8585
/// </summary>
8686
protected override void Initialize()
8787
{
88+
bool bQuitting = false;
8889
base.Initialize();
8990

9091
#if DEBUG
@@ -105,6 +106,13 @@ protected override void Initialize()
105106

106107
DebuggerService.AdviseDebuggerEvents(this, out debugEventCookie);
107108

109+
if (SwitchVsixManifest())
110+
{
111+
bQuitting = true;
112+
RestartVisualStudio();
113+
return;
114+
}
115+
108116
foreach (Type t in Assembly.GetExecutingAssembly().GetTypes())
109117
{
110118
if (//typeof(IBIDSHelperPlugin).IsAssignableFrom(t.GetType())
@@ -157,7 +165,120 @@ protected override void Initialize()
157165
}
158166
finally
159167
{
160-
StatusBar.Clear();
168+
if (!bQuitting)
169+
StatusBar.Clear();
170+
}
171+
172+
}
173+
174+
private bool SwitchVsixManifest()
175+
{
176+
#if SQL2017
177+
string sVersion = VersionInfo.SqlServerVersion.ToString();
178+
if (sVersion.StartsWith("13.")) //this DLL is for SQL 2017 but you have SSDT for SQL2016 installed
179+
{
180+
string sFolder = System.IO.Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName;
181+
string sManifestPath = sFolder + "\\extension.vsixmanifest";
182+
string sBackupManifestPath = sFolder + "\\extension2017.vsixmanifest";
183+
string sOtherManifestPath = sFolder + "\\extension2016.vsixmanifest";
184+
185+
string sPkgdef2017Path = sFolder + "\\BidsHelper2017.pkgdef";
186+
string sPkgdef2017BackupPath = sFolder + "\\BidsHelper2017.pkgdef.bak";
187+
string sPkgdef2016Path = sFolder + "\\BidsHelper2016.pkgdef";
188+
string sPkgdef2016BackupPath = sFolder + "\\BidsHelper2016.pkgdef.bak";
189+
190+
if (System.IO.File.Exists(sOtherManifestPath) && System.IO.File.Exists(sPkgdef2016BackupPath) && System.IO.File.Exists(sPkgdef2017Path))
191+
{
192+
//backup the current SQL2017 manifest
193+
System.IO.File.Copy(sManifestPath, sBackupManifestPath, true);
194+
195+
//copy SQL2016 manifest over the current manifest
196+
System.IO.File.Copy(sOtherManifestPath, sManifestPath, true);
197+
198+
if (System.IO.File.Exists(sPkgdef2016Path))
199+
System.IO.File.Delete(sPkgdef2016BackupPath);
200+
else
201+
System.IO.File.Move(sPkgdef2016BackupPath, sPkgdef2016Path);
202+
203+
if (System.IO.File.Exists(sPkgdef2017BackupPath))
204+
System.IO.File.Delete(sPkgdef2017Path);
205+
else
206+
System.IO.File.Move(sPkgdef2017Path, sPkgdef2017BackupPath);
207+
208+
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");
209+
return true;
210+
}
211+
else
212+
{
213+
throw new Exception("You have SSDT for SQL Server " + VersionInfo.SqlServerFriendlyVersion + " installed but we couldn't find BIDS Helper 2016 files!");
214+
}
215+
}
216+
#elif SQL2016
217+
string sVersion = VersionInfo.SqlServerVersion.ToString();
218+
if (sVersion.StartsWith("14.")) //this DLL is for SQL 2016 but you have SSDT for SQL2017 installed
219+
{
220+
string sFolder = System.IO.Directory.GetParent(System.IO.Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName).FullName;
221+
string sManifestPath = sFolder + "\\extension.vsixmanifest";
222+
string sBackupManifestPath = sFolder + "\\extension2016.vsixmanifest";
223+
string sOtherManifestPath = sFolder + "\\extension2017.vsixmanifest";
224+
225+
string sPkgdef2017Path = sFolder + "\\BidsHelper2017.pkgdef";
226+
string sPkgdef2017BackupPath = sFolder + "\\BidsHelper2017.pkgdef.bak";
227+
string sPkgdef2016Path = sFolder + "\\BidsHelper2016.pkgdef";
228+
string sPkgdef2016BackupPath = sFolder + "\\BidsHelper2016.pkgdef.bak";
229+
230+
if (System.IO.File.Exists(sOtherManifestPath) && System.IO.File.Exists(sPkgdef2017BackupPath) && System.IO.File.Exists(sPkgdef2016Path))
231+
{
232+
//backup the current SQL2016 manifest
233+
System.IO.File.Copy(sManifestPath, sBackupManifestPath, true);
234+
235+
//copy SQL2017 manifest over the current manifest
236+
System.IO.File.Copy(sOtherManifestPath, sManifestPath, true);
237+
238+
if (System.IO.File.Exists(sPkgdef2017Path))
239+
System.IO.File.Delete(sPkgdef2017BackupPath);
240+
else
241+
System.IO.File.Move(sPkgdef2017BackupPath, sPkgdef2017Path);
242+
243+
if (System.IO.File.Exists(sPkgdef2016BackupPath))
244+
System.IO.File.Delete(sPkgdef2016Path);
245+
else
246+
System.IO.File.Move(sPkgdef2016Path, sPkgdef2016BackupPath);
247+
248+
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");
249+
return true;
250+
}
251+
else
252+
{
253+
throw new Exception("You have SSDT for SQL Server " + VersionInfo.SqlServerFriendlyVersion + " installed but we couldn't find BIDS Helper 2017 files!");
254+
}
255+
}
256+
#endif
257+
return false;
258+
259+
}
260+
261+
private void RestartVisualStudio()
262+
{
263+
System.Diagnostics.Process currentProcess = System.Diagnostics.Process.GetCurrentProcess();
264+
System.Diagnostics.Process newProcess = new System.Diagnostics.Process();
265+
newProcess.StartInfo = new System.Diagnostics.ProcessStartInfo {
266+
FileName = currentProcess.MainModule.FileName,
267+
ErrorDialog = true,
268+
UseShellExecute = true,
269+
Arguments = DTE2.CommandLineArguments
270+
};
271+
newProcess.Start();
272+
273+
EnvDTE.Command command = DTE2.Commands.Item("File.Exit", -1);
274+
275+
if ((command != null) && command.IsAvailable)
276+
{
277+
DTE2.ExecuteCommand("File.Exit", "");
278+
}
279+
else
280+
{
281+
DTE2.Quit();
161282
}
162283

163284
}

Core/Options/BIDSHelperOptionsVersion.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ namespace BIDSHelper.Core
1313
{
1414
[ClassInterface(ClassInterfaceType.AutoDual)]
1515
[CLSCompliant(false), ComVisible(true)]
16-
//[Guid(BIDSHelperOptionsVersion.OptionsGuidString)]
16+
[Guid(BIDSHelperOptionsVersion.VersionGuidString)]
1717
public class BIDSHelperOptionsVersion: DialogPage
1818
{
19-
// public const string OptionsGuidString = "9EBCE16B-26C2-4A22-A409-9752750A16AE";
20-
19+
public const string VersionGuidString = "9128d0ed-abbe-3002-9aee-4c06babd03ae";
20+
2121
protected override IWin32Window Window
2222
{
2323
get

Core/VersionInfo.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ public static string SqlServerFriendlyVersion
127127
return "2014";
128128
else if (sVersion.StartsWith("13."))
129129
return "2016";
130+
else if (sVersion.StartsWith("14."))
131+
return "2017";
130132
else
131133
return string.Format("(SQL Unknown {0})", sVersion);
132134
}

Manifest/SQL2017/VSPackage.resx

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<root>
3+
<!--
4+
Microsoft ResX Schema
5+
6+
Version 2.0
7+
8+
The primary goals of this format is to allow a simple XML format
9+
that is mostly human readable. The generation and parsing of the
10+
various data types are done through the TypeConverter classes
11+
associated with the data types.
12+
13+
Example:
14+
15+
... ado.net/XML headers & schema ...
16+
<resheader name="resmimetype">text/microsoft-resx</resheader>
17+
<resheader name="version">2.0</resheader>
18+
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19+
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20+
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21+
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22+
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23+
<value>[base64 mime encoded serialized .NET Framework object]</value>
24+
</data>
25+
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26+
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27+
<comment>This is a comment</comment>
28+
</data>
29+
30+
There are any number of "resheader" rows that contain simple
31+
name/value pairs.
32+
33+
Each data row contains a name, and value. The row also contains a
34+
type or mimetype. Type corresponds to a .NET class that support
35+
text/value conversion through the TypeConverter architecture.
36+
Classes that don't support this are serialized and stored with the
37+
mimetype set.
38+
39+
The mimetype is used for serialized objects, and tells the
40+
ResXResourceReader how to depersist the object. This is currently not
41+
extensible. For a given mimetype the value must be set accordingly:
42+
43+
Note - application/x-microsoft.net.object.binary.base64 is the format
44+
that the ResXResourceWriter will generate, however the reader can
45+
read any of the formats listed below.
46+
47+
mimetype: application/x-microsoft.net.object.binary.base64
48+
value : The object must be serialized with
49+
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50+
: and then encoded with base64 encoding.
51+
52+
mimetype: application/x-microsoft.net.object.soap.base64
53+
value : The object must be serialized with
54+
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55+
: and then encoded with base64 encoding.
56+
57+
mimetype: application/x-microsoft.net.object.bytearray.base64
58+
value : The object must be serialized into a byte array
59+
: using a System.ComponentModel.TypeConverter
60+
: and then encoded with base64 encoding.
61+
-->
62+
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63+
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
64+
<xsd:element name="root" msdata:IsDataSet="true">
65+
<xsd:complexType>
66+
<xsd:choice maxOccurs="unbounded">
67+
<xsd:element name="metadata">
68+
<xsd:complexType>
69+
<xsd:sequence>
70+
<xsd:element name="value" type="xsd:string" minOccurs="0" />
71+
</xsd:sequence>
72+
<xsd:attribute name="name" use="required" type="xsd:string" />
73+
<xsd:attribute name="type" type="xsd:string" />
74+
<xsd:attribute name="mimetype" type="xsd:string" />
75+
<xsd:attribute ref="xml:space" />
76+
</xsd:complexType>
77+
</xsd:element>
78+
<xsd:element name="assembly">
79+
<xsd:complexType>
80+
<xsd:attribute name="alias" type="xsd:string" />
81+
<xsd:attribute name="name" type="xsd:string" />
82+
</xsd:complexType>
83+
</xsd:element>
84+
<xsd:element name="data">
85+
<xsd:complexType>
86+
<xsd:sequence>
87+
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
88+
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
89+
</xsd:sequence>
90+
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91+
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
92+
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
93+
<xsd:attribute ref="xml:space" />
94+
</xsd:complexType>
95+
</xsd:element>
96+
<xsd:element name="resheader">
97+
<xsd:complexType>
98+
<xsd:sequence>
99+
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
100+
</xsd:sequence>
101+
<xsd:attribute name="name" type="xsd:string" use="required" />
102+
</xsd:complexType>
103+
</xsd:element>
104+
</xsd:choice>
105+
</xsd:complexType>
106+
</xsd:element>
107+
</xsd:schema>
108+
<resheader name="resmimetype">
109+
<value>text/microsoft-resx</value>
110+
</resheader>
111+
<resheader name="version">
112+
<value>2.0</value>
113+
</resheader>
114+
<resheader name="reader">
115+
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116+
</resheader>
117+
<resheader name="writer">
118+
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119+
</resheader>
120+
<data name="110" xml:space="preserve">
121+
<value>BIDS Helper 2017 Extension</value>
122+
</data>
123+
<data name="112" xml:space="preserve">
124+
<value>BIDS Helper 2017 Visual Studio Extension v2.0.1 - An add-in to extend SQL Server Data Tools</value>
125+
</data>
126+
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
127+
<data name="400" type="System.Resources.ResXFileRef, System.Windows.Forms">
128+
<value>..\..\Resources\BidsHelper.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
129+
</data>
130+
<data name="deploymdxscript" type="System.Resources.ResXFileRef, System.Windows.Forms">
131+
<value>..\..\Resources\deploymdxscript.xslt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
132+
</data>
133+
<data name="HelpAboutText" type="System.Resources.ResXFileRef, System.Windows.Forms">
134+
<value>..\..\helpabouttext.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
135+
</data>
136+
</root>

Properties/AssemblyInfo.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
[assembly: CLSCompliant(false)]
1919
[assembly: NeutralResourcesLanguage("en-US")]
2020

21-
#if SQL2016
21+
#if SQL2017
22+
[assembly: AssemblyTitle("BIDS Helper for SQL Server 2017")]
23+
#elif SQL2016
2224
[assembly: AssemblyTitle("BIDS Helper for SQL Server 2016")]
2325
#elif SQL2014
2426
[assembly: AssemblyTitle("BIDS Helper for SQL Server 2014")]

SQL2016_BidsHelper.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@
4949
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
5050
<SchemaVersion>2.0</SchemaVersion>
5151
<ProjectTypeGuids>{82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
52-
<ProjectGuid>{0828F434-598D-4E5B-983A-9FAD3BFDE857}</ProjectGuid>
52+
<ProjectGuid>{4EA3FC6B-F3D9-467E-92EA-68AC4C574CB3}</ProjectGuid>
5353
<OutputType>Library</OutputType>
5454
<AppDesignerFolder>Properties</AppDesignerFolder>
5555
<RootNamespace>BIDSHelper</RootNamespace>
56-
<AssemblyName>BidsHelper</AssemblyName>
56+
<AssemblyName>BidsHelper2016</AssemblyName>
5757
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
5858
<GeneratePkgDefFile>true</GeneratePkgDefFile>
5959
<IncludeAssemblyInVSIXContainer>true</IncludeAssemblyInVSIXContainer>

SQL2017_BidsHelper.sln

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 14
4+
VisualStudioVersion = 14.0.25420.1
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SQL2017_BidsHelper", "SQL2017_BidsHelper.csproj", "{0828F434-598D-4E5B-983A-9FAD3BFDE857}"
7+
EndProject
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SQL2016_BidsHelper", "SQL2016_BidsHelper.csproj", "{4EA3FC6B-F3D9-467E-92EA-68AC4C574CB3}"
9+
EndProject
10+
Global
11+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
12+
Debug|Any CPU = Debug|Any CPU
13+
Debug|x86 = Debug|x86
14+
Release|Any CPU = Release|Any CPU
15+
Release|x86 = Release|x86
16+
EndGlobalSection
17+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
18+
{0828F434-598D-4E5B-983A-9FAD3BFDE857}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19+
{0828F434-598D-4E5B-983A-9FAD3BFDE857}.Debug|Any CPU.Build.0 = Debug|Any CPU
20+
{0828F434-598D-4E5B-983A-9FAD3BFDE857}.Debug|x86.ActiveCfg = Debug|x86
21+
{0828F434-598D-4E5B-983A-9FAD3BFDE857}.Debug|x86.Build.0 = Debug|x86
22+
{0828F434-598D-4E5B-983A-9FAD3BFDE857}.Release|Any CPU.ActiveCfg = Release|Any CPU
23+
{0828F434-598D-4E5B-983A-9FAD3BFDE857}.Release|Any CPU.Build.0 = Release|Any CPU
24+
{0828F434-598D-4E5B-983A-9FAD3BFDE857}.Release|x86.ActiveCfg = Release|x86
25+
{0828F434-598D-4E5B-983A-9FAD3BFDE857}.Release|x86.Build.0 = Release|x86
26+
{4EA3FC6B-F3D9-467E-92EA-68AC4C574CB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27+
{4EA3FC6B-F3D9-467E-92EA-68AC4C574CB3}.Debug|Any CPU.Build.0 = Debug|Any CPU
28+
{4EA3FC6B-F3D9-467E-92EA-68AC4C574CB3}.Debug|x86.ActiveCfg = Debug|x86
29+
{4EA3FC6B-F3D9-467E-92EA-68AC4C574CB3}.Debug|x86.Build.0 = Debug|x86
30+
{4EA3FC6B-F3D9-467E-92EA-68AC4C574CB3}.Release|Any CPU.ActiveCfg = Release|Any CPU
31+
{4EA3FC6B-F3D9-467E-92EA-68AC4C574CB3}.Release|Any CPU.Build.0 = Release|Any CPU
32+
{4EA3FC6B-F3D9-467E-92EA-68AC4C574CB3}.Release|x86.ActiveCfg = Release|x86
33+
{4EA3FC6B-F3D9-467E-92EA-68AC4C574CB3}.Release|x86.Build.0 = Release|x86
34+
EndGlobalSection
35+
GlobalSection(SolutionProperties) = preSolution
36+
HideSolutionNode = FALSE
37+
EndGlobalSection
38+
GlobalSection(TeamFoundationVersionControl) = preSolution
39+
SccNumberOfProjects = 3
40+
SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
41+
SccTeamFoundationServer = https://tfs.codeplex.com/tfs/tfs01
42+
SccProjectUniqueName0 = SQL2017_BidsHelper.csproj
43+
SccLocalPath0 = .
44+
SccProjectUniqueName1 = SQL2016_BidsHelper.csproj
45+
SccLocalPath1 = .
46+
SccLocalPath2 = .
47+
EndGlobalSection
48+
EndGlobal

SSAS/DeploymentSettings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public string TargetCubeName
9292
private void SetDefaultTargetServer()
9393
{
9494
Microsoft.Win32.RegistryKey regKey;
95-
#if SQL2016
95+
#if SQL2016 || SQL2017
9696
regKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\VisualStudio\14.0\Packages\{4a0c6509-bf90-43da-abee-0aba3a8527f1}\Settings\Analysis Services Project");
9797
#elif SQL2014
9898
regKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\VisualStudio\12.0\Packages\{4a0c6509-bf90-43da-abee-0aba3a8527f1}\Settings\Analysis Services Project");

0 commit comments

Comments
 (0)