Skip to content

Commit

Permalink
2.4.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
Greg Galloway committed Sep 1, 2020
1 parent eb3e7ad commit 471af0d
Show file tree
Hide file tree
Showing 20 changed files with 229 additions and 57 deletions.
75 changes: 75 additions & 0 deletions BidsHelperPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,29 @@
using BIDSHelper.Core.Logger;
using Task = System.Threading.Tasks.Task;

using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

namespace mscoree
{
[CompilerGenerated]
[Guid("CB2F6722-AB3A-11D2-9C40-00C04FA30A3E")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[TypeIdentifier]
[ComImport]
[CLSCompliant(false)]
public interface ICorRuntimeHost
{
void _VtblGap1_11();

void EnumDomains(out IntPtr enumHandle);

void NextDomain([In] IntPtr enumHandle, [MarshalAs(UnmanagedType.IUnknown)] out object appDomain);

void CloseEnum([In] IntPtr enumHandle);
}
}

namespace BIDSHelper
{

Expand Down Expand Up @@ -686,6 +709,45 @@ System.Reflection.Assembly currentDomain_AssemblyResolve(object sender, ResolveE
string _recursiveAssemblyResolveNameToSkip = null;
System.Collections.Generic.List<string> _assemblyLoadsFailed = new System.Collections.Generic.List<string>();
System.Collections.Generic.List<System.ResolveEventHandler> _microsoftEventHandlersToIgnoreErrors = new System.Collections.Generic.List<ResolveEventHandler>();
AppDomain _defaultAppDomain = null;

private static mscoree.ICorRuntimeHost GetCorRuntimeHost()
{
return (mscoree.ICorRuntimeHost)Activator.CreateInstance(Marshal.GetTypeFromCLSID(new Guid("CB2F6723-AB3A-11D2-9C40-00C04FA30A3E")));
}

public AppDomain GetDefaultAppDomain()
{
IntPtr enumHandle = IntPtr.Zero;
mscoree.ICorRuntimeHost host = GetCorRuntimeHost();
try
{
host.EnumDomains(out enumHandle);

object domain = null;
while (true)
{
host.NextDomain(enumHandle, out domain);

if (domain == null) break;

AppDomain appDomain = (AppDomain)domain;
if (appDomain.IsDefaultAppDomain())
return appDomain;
}
return null;
}
catch (Exception e)
{
Log.Debug("Caught error in Microsoft AssemblyResolve and skipped: " + e.Message);
return null;
}
finally
{
host.CloseEnum(enumHandle);
Marshal.ReleaseComObject(host);
}
}

/// <summary>
/// Only fires if an assembly fails to load. This gives us a chance to redirect to a DLL that does exist.
Expand Down Expand Up @@ -732,9 +794,22 @@ System.Reflection.Assembly currentDomain_AssemblyResolve(object sender, ResolveE
{
if (loadedAlready.GetName().Name == assemblyname.Name
&& loadedAlready.GetName().Version.Major == assemblyname.Version.Major)
//&& loadedAlready.GetName().Version.Minor == assemblyname.Version.Minor
//&& loadedAlready.GetName().Version.MinorRevision == assemblyname.Version.MinorRevision)
return loadedAlready;
}

//if (_defaultAppDomain == null)
// _defaultAppDomain = GetDefaultAppDomain();
//foreach (Assembly loadedAlready in _defaultAppDomain.GetAssemblies())
//{
// if (loadedAlready.GetName().Name == assemblyname.Name
// && loadedAlready.GetName().Version.Major == assemblyname.Version.Major
// && loadedAlready.GetName().Version.Minor == assemblyname.Version.Minor
// && loadedAlready.GetName().Version.MinorRevision == assemblyname.Version.MinorRevision)
// return loadedAlready;
//}

System.Collections.Generic.List<string> pathsToCheck = new System.Collections.Generic.List<string>();
var bidsHelperPath = new System.IO.FileInfo(typeof(BIDSHelperPackage).Assembly.Location);
pathsToCheck.Add(bidsHelperPath.DirectoryName + "\\");
Expand Down
2 changes: 1 addition & 1 deletion Core/VersionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class VersionInfo
{
// BIDS Helper Assembly & VSIX Version
// N.B. Manually update the manifest file, if you change this - See source.extension.vsixmanifest
public const string Version = "2.3.9";
public const string Version = "2.4.0";

private static readonly object lockResource = new object();
private static Version visualStudioVersion;
Expand Down
2 changes: 1 addition & 1 deletion Manifest/SQL2017/VSPackageVS2017.resx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
<value>BI Developer Extensions for Visual Studio 2017</value>
</data>
<data name="112" xml:space="preserve">
<value>BI Developer Extensions v2.3.9 for Visual Studio 2017 - An add-in to extend SQL Server Data Tools</value>
<value>BI Developer Extensions v2.4.0 for Visual Studio 2017 - An add-in to extend SQL Server Data Tools</value>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="400" type="System.Resources.ResXFileRef, System.Windows.Forms">
Expand Down
2 changes: 1 addition & 1 deletion Manifest/SQL2017/source.extension.vsixmanifest
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="BIDSHelper_VSIX.b6deed2d-6c6f-46d4-94be-28027bf7d873" Version="2.3.9" Language="en-US" Publisher="bideveloperextensions.github.io" />
<Identity Id="BIDSHelper_VSIX.b6deed2d-6c6f-46d4-94be-28027bf7d873" Version="2.4.0" Language="en-US" Publisher="bideveloperextensions.github.io" />
<DisplayName>BI Developer Extensions for Visual Studio 2017</DisplayName>
<Description xml:space="preserve">BI Developer Extensions (formerly BIDS Helper) is an extension for BIDS / SSDT that includes numerous enhancements for SQL Server BI projects</Description>
<MoreInfo>https://bideveloperextensions.github.io</MoreInfo>
Expand Down
2 changes: 1 addition & 1 deletion Manifest/SQL2019/VSPackageVS2019.resx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
<value>BI Developer Extensions for Visual Studio 2019</value>
</data>
<data name="112" xml:space="preserve">
<value>BI Developer Extensions v2.3.9 for Visual Studio 2019 - An add-in to extend SQL Server Data Tools</value>
<value>BI Developer Extensions v2.4.0 for Visual Studio 2019 - An add-in to extend SQL Server Data Tools</value>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="400" type="System.Resources.ResXFileRef, System.Windows.Forms">
Expand Down
2 changes: 1 addition & 1 deletion Manifest/SQL2019/source.extension.vsixmanifest
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="BIDSHelper_VSIX.b6deed2d-6c6f-46d4-94be-28027bf7d874" Version="2.3.9" Language="en-US" Publisher="bideveloperextensions.github.io" />
<Identity Id="BIDSHelper_VSIX.b6deed2d-6c6f-46d4-94be-28027bf7d874" Version="2.4.0" Language="en-US" Publisher="bideveloperextensions.github.io" />
<DisplayName>BI Developer Extensions for Visual Studio 2019</DisplayName>
<Description xml:space="preserve">BI Developer Extensions (formerly BIDS Helper) is an extension for BIDS / SSDT that includes numerous enhancements for SQL Server BI projects</Description>
<MoreInfo>https://bideveloperextensions.github.io</MoreInfo>
Expand Down
5 changes: 3 additions & 2 deletions SQL2019_VS2017_BidsHelper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -1167,8 +1167,9 @@
</Target>
-->
<PropertyGroup>
<PostBuildEvent>
</PostBuildEvent>
<PostBuildEvent>copy "C:\projects\BIDS Helper\GitHub\bideveloperextensions2\bin\Debug\BidsHelper2019.dll" "C:\Users\ggalloway\AppData\Local\Microsoft\VisualStudio\15.0_849621d1Exp\Extensions\yh2cp5be.3c3"
copy "C:\projects\BIDS Helper\GitHub\bideveloperextensions2\bin\Debug\BidsHelper2019.pdb" "C:\Users\ggalloway\AppData\Local\Microsoft\VisualStudio\15.0_849621d1Exp\Extensions\yh2cp5be.3c3"
</PostBuildEvent>
</PropertyGroup>
<PropertyGroup Label="VsixCompress">
<VsixCompressTargets Condition=" '$(VsixCompressTargets)'=='' ">$([System.IO.Path]::GetFullPath( $(MSBuildProjectDirectory)\.\packages\VsixCompress.1.0.1\tools\vsix-compress.targets ))</VsixCompressTargets>
Expand Down
27 changes: 22 additions & 5 deletions SSAS/CalcHelpersPlugin.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#if SQL2019
extern alias asAlias;
extern alias sharedDataWarehouseInterfaces;
extern alias asDataWarehouseInterfaces;
using asAlias::Microsoft.DataWarehouse.Design;
using asAlias::Microsoft.DataWarehouse.Controls;
using sharedDataWarehouseInterfaces::Microsoft.DataWarehouse.Design;
Expand Down Expand Up @@ -308,14 +309,30 @@ void OpenCalcPropertiesDialog()
System.IServiceProvider provider = (System.IServiceProvider)this.ApplicationObject.ActiveWindow.ProjectItem.ContainingProject;
using (WaitCursor cursor1 = new WaitCursor())
{
IUserPromptService oService = (IUserPromptService)provider.GetService(typeof(IUserPromptService));
try
{
IUserPromptService oService = (IUserPromptService)provider.GetService(typeof(IUserPromptService));

foreach (Type t in System.Reflection.Assembly.GetAssembly(typeof(Scripts)).GetTypes())
foreach (Type t in System.Reflection.Assembly.GetAssembly(typeof(Scripts)).GetTypes())
{
if (t.FullName == "Microsoft.AnalysisServices.Design.Calculations.CalcPropertiesEditorForm")
{
form1 = (Form)t.GetConstructor(new Type[] { typeof(IUserPromptService) }).Invoke(new object[] { oService });
break;
}
}
}
catch (Exception ex)
{
if (t.FullName == "Microsoft.AnalysisServices.Design.Calculations.CalcPropertiesEditorForm")
asDataWarehouseInterfaces::Microsoft.DataWarehouse.Design.IUserPromptService oService = (asDataWarehouseInterfaces::Microsoft.DataWarehouse.Design.IUserPromptService)provider.GetService(typeof(asDataWarehouseInterfaces::Microsoft.DataWarehouse.Design.IUserPromptService));

foreach (Type t in System.Reflection.Assembly.GetAssembly(typeof(Scripts)).GetTypes())
{
form1 = (Form)t.GetConstructor(new Type[] { typeof(IUserPromptService) }).Invoke(new object[] { oService });
break;
if (t.FullName == "Microsoft.AnalysisServices.Design.Calculations.CalcPropertiesEditorForm")
{
form1 = (Form)t.GetConstructor(new Type[] { typeof(asDataWarehouseInterfaces::Microsoft.DataWarehouse.Design.IUserPromptService) }).Invoke(new object[] { oService });
break;
}
}
}
if (form1 == null) throw new Exception("Couldn't create instance of CalcPropertiesEditorForm");
Expand Down
5 changes: 4 additions & 1 deletion SSAS/DeploymentSettings.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
extern alias sharedDataWarehouseInterfaces;
extern alias asDataWarehouseInterfaces;
using System;
using System.Xml;
//using Extensibility;
Expand Down Expand Up @@ -54,7 +55,9 @@ void PopulateDeploymentSettings(Project project)
object oService = null;
if (project is System.IServiceProvider) //Multidimensional
{
oService = typeof(System.IServiceProvider).InvokeMember("GetService", flags, null, project, new object[] { typeof(IConfigurationSettings) });
oService = project.GetIConfigurationSettings();
if (oService == null) throw new Exception("Could not GetService IConfigurationSettings in project from " + project.GetType().Assembly.Location);

string sTargetServer = (string)oService.GetType().InvokeMember("GetSetting", flags, null, oService, new object[] { "TargetServer" });
if (!String.IsNullOrEmpty(sTargetServer)) mTargetServer = sTargetServer;
string sTargetDatabase = (string)oService.GetType().InvokeMember("GetSetting", flags, null, oService, new object[] { "TargetDatabase" });
Expand Down
4 changes: 3 additions & 1 deletion SSAS/PCDimNaturalizer/PCDimNaturalizerPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,9 @@ private void ExecDimension(ProjectItem pi)
Program.SQLFlattener = null;

asAlias::Microsoft.DataWarehouse.VsIntegration.Shell.Project.IFileProjectHierarchy projectService = (asAlias::Microsoft.DataWarehouse.VsIntegration.Shell.Project.IFileProjectHierarchy)((System.IServiceProvider)pi.ContainingProject).GetService(typeof(asAlias::Microsoft.DataWarehouse.VsIntegration.Shell.Project.IFileProjectHierarchy));
sharedDataWarehouseInterfaces::Microsoft.DataWarehouse.Interfaces.IConfigurationSettings settings = (sharedDataWarehouseInterfaces::Microsoft.DataWarehouse.Interfaces.IConfigurationSettings)((System.IServiceProvider)pi.ContainingProject).GetService(typeof(sharedDataWarehouseInterfaces::Microsoft.DataWarehouse.Interfaces.IConfigurationSettings));
object settings = pi.ContainingProject.GetIConfigurationSettings();
if (settings == null) throw new Exception("Could not GetService IConfigurationSettings in project from " + pi.ContainingProject.GetType().Assembly.Location);

asAlias::Microsoft.DataWarehouse.Project.DataWarehouseProjectManager projectManager = (asAlias::Microsoft.DataWarehouse.Project.DataWarehouseProjectManager)settings.GetType().InvokeMember("ProjectManager", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.GetProperty | System.Reflection.BindingFlags.FlattenHierarchy, null, settings, null);

Dimension dimNew = dim.Clone();
Expand Down
11 changes: 7 additions & 4 deletions SSIS/DeployPackagesPlugin.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
extern alias sharedDataWarehouseInterfaces;
extern alias asDataWarehouseInterfaces;
extern alias asAlias;
using EnvDTE;
using EnvDTE80;
using System.Text;
Expand Down Expand Up @@ -153,7 +155,7 @@ public override void Exec()
bJustDeploySelectedPackages = true;
}

sharedDataWarehouseInterfaces::Microsoft.DataWarehouse.Interfaces.IConfigurationSettings settings = (sharedDataWarehouseInterfaces::Microsoft.DataWarehouse.Interfaces.IConfigurationSettings)((System.IServiceProvider)projects[0]).GetService(typeof(sharedDataWarehouseInterfaces::Microsoft.DataWarehouse.Interfaces.IConfigurationSettings));
object settings = projects[0].GetIConfigurationSettings();
if (settings == null)
{
MessageBox.Show("Could not get IConfigurationSettings");
Expand Down Expand Up @@ -205,7 +207,7 @@ public override void Exec()

private void DeployProject(Project proj, IOutputWindow outputWindow, System.Array selectedItems, bool bCreateBat)
{
sharedDataWarehouseInterfaces::Microsoft.DataWarehouse.Interfaces.IConfigurationSettings settings = (sharedDataWarehouseInterfaces::Microsoft.DataWarehouse.Interfaces.IConfigurationSettings)((System.IServiceProvider)proj).GetService(typeof(sharedDataWarehouseInterfaces::Microsoft.DataWarehouse.Interfaces.IConfigurationSettings));
object settings = proj.GetIConfigurationSettings();
if (settings == null)
{
MessageBox.Show("Could not get IConfigurationSettings");
Expand Down Expand Up @@ -525,7 +527,7 @@ private void cmdButtonProperties_Click(CommandBarButton Ctrl, ref bool CancelDef
return;
}

sharedDataWarehouseInterfaces::Microsoft.DataWarehouse.Interfaces.IConfigurationSettings settings = (sharedDataWarehouseInterfaces::Microsoft.DataWarehouse.Interfaces.IConfigurationSettings)((System.IServiceProvider)proj).GetService(typeof(sharedDataWarehouseInterfaces::Microsoft.DataWarehouse.Interfaces.IConfigurationSettings));
object settings = proj.GetIConfigurationSettings();
if (settings == null)
{
CancelDefault = false; //let the Microsoft code fire
Expand Down Expand Up @@ -590,7 +592,8 @@ private void cmdButtonProperties_Click(CommandBarButton Ctrl, ref bool CancelDef
/// <returns>true if the project uses the legacy package deployment model; otherwise else false.</returns>
public static bool IsLegacyDeploymentMode(Project project)
{
sharedDataWarehouseInterfaces::Microsoft.DataWarehouse.Interfaces.IConfigurationSettings settings = (sharedDataWarehouseInterfaces::Microsoft.DataWarehouse.Interfaces.IConfigurationSettings)((System.IServiceProvider)project).GetService(typeof(sharedDataWarehouseInterfaces::Microsoft.DataWarehouse.Interfaces.IConfigurationSettings));
object settings = project.GetIConfigurationSettings();
if (settings == null) return false;
DataWarehouseProjectManager projectManager = (DataWarehouseProjectManager)settings.GetType().InvokeMember("ProjectManager", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.GetProperty | System.Reflection.BindingFlags.FlattenHierarchy, null, settings, null);
return IsLegacyDeploymentMode(projectManager);
}
Expand Down
12 changes: 4 additions & 8 deletions SSIS/DesignPracticeScanner/ConnectionConfigurationPractice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
//using System.Linq;
using System.Text;
using Microsoft.SqlServer.Dts.Runtime;
using EnvDTE;

namespace BIDSHelper.SSIS.DesignPracticeScanner
{
Expand All @@ -20,17 +21,12 @@ public override void Check(Package package, EnvDTE.ProjectItem projectItem)
Results.Clear();
string sVisualStudioRelativePath = projectItem.DTE.FullName.Substring(0, projectItem.DTE.FullName.LastIndexOf('\\') + 1);

bool bOfflineMode = false;
try
{
sharedDataWarehouseInterfaces::Microsoft.DataWarehouse.Interfaces.IConfigurationSettings settings = (sharedDataWarehouseInterfaces::Microsoft.DataWarehouse.Interfaces.IConfigurationSettings)((System.IServiceProvider)projectItem.ContainingProject).GetService(typeof(sharedDataWarehouseInterfaces::Microsoft.DataWarehouse.Interfaces.IConfigurationSettings));
bOfflineMode = (bool)settings.GetSetting("OfflineMode");
}
catch { }
bool bOfflineMode = projectItem.ContainingProject.GetOfflineMode();



List<string> configPaths = new List<string>(package.Configurations.Count);
foreach (Configuration c in package.Configurations)
foreach (Microsoft.SqlServer.Dts.Runtime.Configuration c in package.Configurations)
{
foreach (PackageConfigurationSetting setting in PackageConfigurationLoader.GetPackageConfigurationSettings(c, package, sVisualStudioRelativePath, bOfflineMode))
{
Expand Down
Loading

0 comments on commit 471af0d

Please sign in to comment.