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");
            }
        }
Ejemplo n.º 2
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!");
            }
        }