Skip to content

Commit

Permalink
Add Support for SSMS 17
Browse files Browse the repository at this point in the history
  • Loading branch information
TaoK committed Oct 17, 2017
1 parent 03220dc commit f5bbf5b
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public class SSMSPackageActions
{
const string SSMS2014FILEKEY = "SSMS2014FILE";
const string SSMS2016FILEKEY = "SSMS2016FILE";
const string SSMS17FILEKEY = "SSMS17FILE";
const string APPLICATIONFOLDERKEY = "APPLICATIONFOLDER";
const string CODEBASEENTRYPREFIX = "\"CodeBase\"=\"";
const string PACKAGEFOLDERVARIABLE = "$PackageFolder$\\";
Expand All @@ -46,6 +47,12 @@ public static ActionResult PkgDefUpdateAction2016(Session session)
return PkgDefUpdateAction(session, session.CustomActionData[SSMS2016FILEKEY]);
}

[CustomAction]
public static ActionResult PkgDefUpdateAction17(Session session)
{
return PkgDefUpdateAction(session, session.CustomActionData[SSMS17FILEKEY]);
}


public static ActionResult PkgDefUpdateAction(Session session, string ssmsExtensionsPath)
{
Expand Down
69 changes: 56 additions & 13 deletions PoorMansTSqlFormatterSSMSPackage.Setup/Product.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -48,36 +48,53 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
Value='APPLICATIONFOLDER=[APPLICATIONFOLDER];SSMS2014FILE=[#PkgDefExtensionsHookup2014]'
/>

<CustomAction Id='PrepActionData2016'
Property='SetupPackageFilterAction2016'
<CustomAction Id='PrepActionData2016'
Property='SetupPackageFilterAction2016'
Value='APPLICATIONFOLDER=[APPLICATIONFOLDER];SSMS2016FILE=[#PkgDefExtensionsHookup2016]'
/>

<CustomAction Id='PrepActionData17'
Property='SetupPackageFilterAction17'
Value='APPLICATIONFOLDER=[APPLICATIONFOLDER];SSMS17FILE=[#PkgDefExtensionsHookup17]'
/>

<CustomAction Id="SetupPackageFilterAction2014"
Return="check"
Execute="deferred"
BinaryKey="PoorMansTSqlFormatterSSMSPackage.Setup.action.CA.dll"
DllEntry="PkgDefUpdateAction2014"
Impersonate="no"
/>
<CustomAction Id="SetupPackageFilterAction2016"

<CustomAction Id="SetupPackageFilterAction2016"
Return="check"
Execute="deferred"
BinaryKey="PoorMansTSqlFormatterSSMSPackage.Setup.action.CA.dll"
DllEntry="PkgDefUpdateAction2016"
BinaryKey="PoorMansTSqlFormatterSSMSPackage.Setup.action.CA.dll"
DllEntry="PkgDefUpdateAction2016"
Impersonate="no"
/>

<CustomAction Id="SetupPackageFilterAction17"
Return="check"
Execute="deferred"
BinaryKey="PoorMansTSqlFormatterSSMSPackage.Setup.action.CA.dll"
DllEntry="PkgDefUpdateAction17"
Impersonate="no"
/>

<InstallExecuteSequence>
<Custom Action="PrepActionData2014" Before="InstallInitialize" />
<Custom Action="PrepActionData2016" Before="InstallInitialize" />
<Custom Action="PrepActionData17" Before="InstallInitialize" />
<Custom Action="SetupPackageFilterAction2014" Before="InstallFinalize">
<![CDATA[&SSMS2014Feature=3]]>
</Custom>
<Custom Action="SetupPackageFilterAction2016" Before="InstallFinalize">
<![CDATA[&SSMS2016Feature=3]]>
</Custom>
<Custom Action="SetupPackageFilterAction17" Before="InstallFinalize">
<![CDATA[&SSMS17Feature=3]]>
</Custom>
</InstallExecuteSequence>

<Feature
Expand Down Expand Up @@ -105,17 +122,29 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<!-- Level 1 means "install by default". We're overriding that default level of the feature based on the Condition, and 0 has special meaning "remove option". -->
<Feature
Id="SSMS2016Feature"
Title="SSMS 2016 integration"
Title="SSMS 2016 integration"
Level="1"
AllowAdvertise='no'
InstallDefault='local'
>
<Condition Level='0'>
<![CDATA[NOT SSMS2016EXTENSIONSFOLDER]]>
</Condition>
<ComponentGroupRef Id="SSMS2016ComponentGroup" />
<ComponentGroupRef Id="SSMS2016ComponentGroup" />
</Feature>
</Feature>
<Feature
Id="SSMS17Feature"
Title="SSMS 17 integration"
Level="1"
AllowAdvertise='no'
InstallDefault='local'
>
<Condition Level='0'>
<![CDATA[NOT SSMS17EXTENSIONSFOLDER]]>
</Condition>
<ComponentGroupRef Id="SSMS17ComponentGroup" />
</Feature>
</Feature>

<!-- for the "WixUI_Advanced" UI -->
<Property
Expand Down Expand Up @@ -153,9 +182,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<Property Id="SSMS2016EXTENSIONSFOLDER">
<RegistrySearch Id='SSMS2016ExtensionsFolderRegistrySearch' Type='raw' Root='HKCU' Key='Software\Microsoft\SQL Server Management Studio\13.0_Config\Initialization' Name='ApplicationExtensionsFolder' />
</Property>
<Property Id="SSMS17EXTENSIONSFOLDER">
<RegistrySearch Id='SSMS17ExtensionsFolderRegistrySearch' Type='raw' Root='HKCU' Key='Software\Microsoft\SQL Server Management Studio\14.0_Config\Initialization' Name='ApplicationExtensionsFolder' />
</Property>

<Condition Message='This setup requires SSMS 2016 or SSMS 2014 installed.'>
<![CDATA[Installed OR SSMS2014EXTENSIONSFOLDER OR SSMS2016EXTENSIONSFOLDER]]>
<Condition Message='This setup requires SSMS 2014, 2016 or 17 installed.'>
<![CDATA[Installed OR SSMS2014EXTENSIONSFOLDER OR SSMS2016EXTENSIONSFOLDER OR SSMS17EXTENSIONSFOLDER]]>
</Condition>

</Product>
Expand All @@ -174,6 +206,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
otherwise they default to this "Name" in C:\, but are never used. -->
<Directory Id="SSMS2014EXTENSIONSFOLDER" Name="2014DefaultFolder" />
<Directory Id="SSMS2016EXTENSIONSFOLDER" Name="2016DefaultFolder" />
<Directory Id="SSMS17EXTENSIONSFOLDER" Name="17DefaultFolder" />
</Directory>
</Fragment>

Expand Down Expand Up @@ -208,7 +241,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<File Source="$(var.PoorMansTSqlFormatterSSMSPackage.TargetDir)PoorMansTSqlFormatterSSMSPackage.pkgdef" Id="PkgDefExtensionsHookup2014" KeyPath="yes" />
</Component>
</ComponentGroup>
<ComponentGroup Id="SSMS2016ComponentGroup">
<ComponentGroup Id="SSMS2016ComponentGroup">
<Component Id='SSMS2016StartupFlag' Directory='APPLICATIONFOLDER' Guid='8bd333e5-8804-4c65-9e49-f83eae90d9f5'>
<RegistryKey Root='HKCU' Key='Software\Microsoft\SQL Server Management Studio\13.0\Packages\{5E84B709-1E60-4116-A702-4CDB1A282D6E}'>
<RegistryValue Type='integer' Name='SkipLoading' Value='1'/>
Expand All @@ -218,5 +251,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<File Source="$(var.PoorMansTSqlFormatterSSMSPackage.TargetDir)PoorMansTSqlFormatterSSMSPackage.pkgdef" Id="PkgDefExtensionsHookup2016" KeyPath="yes" />
</Component>
</ComponentGroup>
</Fragment>
<ComponentGroup Id="SSMS17ComponentGroup">
<Component Id='SSMS17StartupFlag' Directory='APPLICATIONFOLDER' Guid='65e2aa45-d394-41cf-9511-004bc915e985'>
<RegistryKey Root='HKCU' Key='Software\Microsoft\SQL Server Management Studio\14.0\Packages\{5E84B709-1E60-4116-A702-4CDB1A282D6E}'>
<RegistryValue Type='integer' Name='SkipLoading' Value='1'/>
</RegistryKey>
</Component>
<Component Id="SSMS17PackageDefFile" Directory="SSMS17EXTENSIONSFOLDER" Guid='06f480cd-1c78-4e37-8f43-d8b79f1c6808'>
<File Source="$(var.PoorMansTSqlFormatterSSMSPackage.TargetDir)PoorMansTSqlFormatterSSMSPackage.pkgdef" Id="PkgDefExtensionsHookup17" KeyPath="yes" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
2 changes: 1 addition & 1 deletion PoorMansTSqlFormatterSSMSPackage/FormatterPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ private void SetPackageLoadingDisableKeyIfRequired()
string fullName = dte.FullName.ToUpperInvariant();
int majorVersion = int.Parse(dte.Version.Split('.')[0]);

if ((fullName.Contains("SSMS") || fullName.Contains("MANAGEMENT STUDIO")) && majorVersion <= 2015)
if ((fullName.Contains("SSMS") || fullName.Contains("MANAGEMENT STUDIO")) && majorVersion <= 2017)
UserRegistryRoot.CreateSubKey(@"Packages\{" + guidPoorMansTSqlFormatterSSMSPackagePkgString + "}").SetValue("SkipLoading", 1);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ You should have received a copy of the GNU Affero General Public License

[assembly: AssemblyTitle("PoorMansTSqlFormatterSSMSPackage")]
[//Note, this is also in resources file for localization!
assembly: AssemblyDescription("A simple free (AGPL) T-SQL Formatting Extension for SSMS 2014-2016 and Visual Studio 2012-2015.")]
assembly: AssemblyDescription("A simple free (AGPL) T-SQL Formatting Extension for SSMS 2014-17 and Visual Studio 2013-2017.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PoorMansTSqlFormatterSSMSPackage")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!--
Poor Man's T-SQL Formatter - a small free Transact-SQL formatting
library for .Net 2.0 and JS, written in C#.
Copyright (C) 2016 Tao Klerks
Copyright (C) 2016-2017 Tao Klerks
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
Expand All @@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<Metadata>
<Identity Id="5e84b709-1e60-4116-a702-4cdb1a282d6e" Version="1.6.1" Language="en-US" Publisher="Tao Klerks" />
<DisplayName>Poor Man's T-Sql Formatter SSMS/VS Extension</DisplayName>
<Description xml:space="preserve">A simple free (AGPL) T-SQL Formatting Extension for SSMS and SSMS Express 2014-2016 and Visual Studio 2013-2017.</Description>
<Description xml:space="preserve">A simple free (AGPL) T-SQL Formatting Extension for SSMS 2014-17 and Visual Studio 2013-2017.</Description>
<MoreInfo>http://architectshack.com/PoorMansTSqlFormatter.ashx</MoreInfo>
<License>LICENSE.rtf</License>
</Metadata>
Expand Down

0 comments on commit f5bbf5b

Please sign in to comment.