Beispiel #1
0
        /// <summary>
        /// Get the SsisTargetServerVersion of a project. See PackageHelper.SetTargetServerVersion and PackageHelper.TargetServerVersion or actual usage.
        /// </summary>
        /// <param name="project">The project to get the version of</param>
        /// <returns>The DTSTargetServerVersion of the project specified.</returns>
        /// <remarks>Do not use directly, see PackageHelper.SetTargetServerVersion and PackageHelper.TargetServerVersion for actual usage.</remarks>
        internal static SsisTargetServerVersion GetTargetServerVersion(EnvDTE.Project project)
        {
#if DENALI || SQL2014
            return(CompilationVersion);
#else
            // TODO: If this doesn't work <2016, we can just hardcode, based on conditional compiation
            Microsoft.DataWarehouse.Interfaces.IConfigurationSettings settings = (Microsoft.DataWarehouse.Interfaces.IConfigurationSettings)((System.IServiceProvider)project).GetService(typeof(Microsoft.DataWarehouse.Interfaces.IConfigurationSettings));
            DataWarehouseProjectManager projectManager = (DataWarehouseProjectManager)PackageHelper.GetPropertyValue(settings, "ProjectManager");
            Microsoft.DataTransformationServices.Project.DataTransformationsProjectConfigurationOptions options = (Microsoft.DataTransformationServices.Project.DataTransformationsProjectConfigurationOptions)projectManager.ConfigurationManager.CurrentConfiguration.Options;
            return((SsisTargetServerVersion)options.TargetServerVersion);
#endif
        }
        private void RefreshProjectAndPackageProperties()
        {
            //save package to disk
            if (projectItem.Document != null && !projectItem.Document.Saved)
            {
                projectItem.Save("");
            }

            //get package password
            Microsoft.DataTransformationServices.Design.DtsBasePackageDesigner rootDesigner = typeof(EditorWindow).InvokeMember("designer", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.DeclaredOnly | System.Reflection.BindingFlags.GetField, null, parentWin, null) as Microsoft.DataTransformationServices.Design.DtsBasePackageDesigner;
            if (rootDesigner == null)
            {
                throw new Exception("Can't find SSIS Package designer control.");
            }
            this.packagePassword    = rootDesigner.GetPackagePassword();
            ssisApp.PackagePassword = this.packagePassword;

            //get setting that says whether to use 64-bit dtexec
            Microsoft.DataTransformationServices.Project.DataTransformationsProjectConfigurationOptions options = (Microsoft.DataTransformationServices.Project.DataTransformationsProjectConfigurationOptions)projectManager.ConfigurationManager.CurrentConfiguration.Options;
            this.use64Bit = options.Run64BitRuntime;

            // Refreshes cached target version which is needed in GetPathToDtsExecutable below
            PackageHelper.SetTargetServerVersion(projectItem.ContainingProject);

            //get a new copy of the SSIS app because we just set the target server version
            ssisApp = SSIS.PackageHelper.Application;

            //get path to dtexec
            this.dtexecPath = GetPathToDtsExecutable("dtexec.exe", this.use64Bit);
            if (this.dtexecPath == null && this.use64Bit)
            {
                this.dtexecPath = GetPathToDtsExecutable("dtexec.exe", false);
            }
            if (this.dtexecPath == null)
            {
                throw new Exception("Can't find path to dtexec in registry! Please make sure you have the SSIS service installed from the " + PackageHelper.TargetServerVersion.ToString() + " install media");
            }
        }
Beispiel #3
0
        private void RefreshProjectAndPackageProperties()
        {
            //save package to disk
            if (projectItem.Document != null && !projectItem.Document.Saved)
            {
                projectItem.Save("");
            }

            //get package password
            Microsoft.DataTransformationServices.Design.DtsBasePackageDesigner rootDesigner = typeof(EditorWindow).InvokeMember("designer", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.DeclaredOnly | System.Reflection.BindingFlags.GetField, null, parentWin, null) as Microsoft.DataTransformationServices.Design.DtsBasePackageDesigner;
            if (rootDesigner == null)
            {
                throw new Exception("Can't find SSIS Package designer control.");
            }
            this.packagePassword    = rootDesigner.GetPackagePassword();
            ssisApp.PackagePassword = this.packagePassword;

            //get setting that says whether to use 64-bit dtexec
            Microsoft.DataTransformationServices.Project.DataTransformationsProjectConfigurationOptions options = (Microsoft.DataTransformationServices.Project.DataTransformationsProjectConfigurationOptions)projectManager.ConfigurationManager.CurrentConfiguration.Options;
            this.use64Bit = options.Run64BitRuntime;

#if SQL2014
            //refreshes the cached target version which is needed in GetPathToDtsExecutable below
            SSISHelpers.ProjectTargetVersion?projectTargetVersion = SSISHelpers.GetProjectTargetVersion(this.projectItem.ContainingProject);
#endif

            //get path to dtexec
            this.dtexecPath = GetPathToDtsExecutable("dtexec.exe", this.use64Bit);
            if (this.dtexecPath == null && this.use64Bit)
            {
                this.dtexecPath = GetPathToDtsExecutable("dtexec.exe", false);
            }
            if (this.dtexecPath == null)
            {
                throw new Exception("Can't find path to dtexec in registry!");
            }
        }