Esempio n. 1
0
        public void ExecuteProcess(DeploymentSet dacPacInfo, PackageAction action)
        {
            switch (action)
            {
            case PackageAction.Report:
                _reportOutputFile = Path.Combine(CreateSessionFolder(_reportFolder, "Reports"), Settings.Default.PrePublishReportFilename);
                _args             = string.Format("/SourceFile:\"{0}\" /Profile:\"{1}\" /Action:DeployReport /OutputPath:\"{2}\"", dacPacInfo.DacPacFilePath, dacPacInfo.PublishProfileFilePath, _reportOutputFile);
                break;

            case PackageAction.DriftReport:
                _driftReportOutputFile = Path.Combine(CreateSessionFolder(_reportFolder, "Reports"), Settings.Default.DriftReportFilename);
                //_args = string.Format("/TargetServerName:\"{0}\" /TargetDatabaseName:\"{1}\" /Action:DriftReport /OutputPath:\"{2}\"", "V-DEV-WEB-008\\DATA", "SSDTProject", _driftReportOutputFile);
                _args = string.Format("/TargetConnectionString:\"{0}\" /Action:DriftReport /OutputPath:\"{1}\"", dacPacInfo.TargetConnectionString, _driftReportOutputFile);
                break;

            case PackageAction.Publish:
                _args = string.Format("/SourceFile:\"{0}\" /Profile:\"{1}\" /Action:Publish", dacPacInfo.DacPacFilePath, dacPacInfo.PublishProfileFilePath);
                break;

            case PackageAction.Script:
                _scriptOutputFile = Path.Combine(CreateSessionFolder(_reportFolder, "Reports"), Settings.Default.ScriptFilename);
                _args             = string.Format("/SourceFile:\"{0}\" /Profile:\"{1}\" /OutputPath:\"{2}\" /Action:Script", dacPacInfo.DacPacFilePath, dacPacInfo.PublishProfileFilePath, _scriptOutputFile);
                break;

            default:
                _args = string.Empty;
                break;
            }

            using (var proc = new System.Diagnostics.Process())
            {
                proc.StartInfo.FileName               = Settings.Default.SqlPackageExeLocation;
                proc.StartInfo.Arguments              = _args;
                proc.StartInfo.UseShellExecute        = false;
                proc.EnableRaisingEvents              = true;
                proc.StartInfo.WindowStyle            = ProcessWindowStyle.Normal;
                proc.StartInfo.CreateNoWindow         = true;
                proc.StartInfo.RedirectStandardInput  = true;
                proc.StartInfo.RedirectStandardOutput = true;
                proc.StartInfo.RedirectStandardError  = true;
                proc.EnableRaisingEvents              = true;
                proc.OutputDataReceived              += ProcOutputDataReceived;
                proc.ErrorDataReceived += ProcOutputDataReceived;
                proc.Start();
                proc.BeginOutputReadLine();
                proc.BeginErrorReadLine();
                proc.WaitForExit();
            }

            Logging.Logger.Log.Info(string.Format("Command Line Arguments:{0}{1}{0}", Environment.NewLine, _args));

            Reporting(action);
        }
Esempio n. 2
0
        private void BtnDeployClick(object sender, EventArgs e)
        {
            processOutput.Text = string.Empty;
            var deploymentSet = new DeploymentSet
            {
                DacPacFilePath         = txtDacPacFilePath.Text,
                PublishProfileFilePath = txtPublishFilePath.Text,
                TypeOfReport           = DeploymentSet.ReportType.Nothing,
            };

            if (!string.IsNullOrWhiteSpace(deploymentSet.DacPacFilePath) && !string.IsNullOrWhiteSpace(deploymentSet.PublishProfileFilePath))
            {
                btnDeploy.Enabled = false;
                _deployWorker.RunWorkerAsync(deploymentSet);
            }
        }
Esempio n. 3
0
        private void BtnReportClick(object sender, EventArgs e)
        {
            reportOutput.Text = string.Empty;
            var deploymentSet = new DeploymentSet
            {
                DacPacFilePath         = txtDacPacFilePath.Text,
                PublishProfileFilePath = txtPublishFilePath.Text,
                TypeOfReport           = DeploymentSet.ReportType.PublishReport,
            };

            if (string.IsNullOrWhiteSpace(deploymentSet.DacPacFilePath) ||
                string.IsNullOrWhiteSpace(deploymentSet.PublishProfileFilePath))
            {
                return;
            }
            btnReport.Enabled      = false;
            btnDriftReport.Enabled = false;
            _reportWorker.RunWorkerAsync(deploymentSet);
        }
Esempio n. 4
0
        private void BtnDriftReportClick(object sender, EventArgs e)
        {
            reportOutput.Text = string.Empty;
            var pubInfo       = ParseAndDisplayProfileInfo(txtPublishFilePath.Text);
            var deploymentSet = new DeploymentSet
            {
                DacPacFilePath         = txtDacPacFilePath.Text,
                PublishProfileFilePath = txtPublishFilePath.Text,
                TargetConnectionString = pubInfo.TargetConnectionString,
                TargetDatabaseName     = pubInfo.TargetDatabaseName,
                TypeOfReport           = DeploymentSet.ReportType.DriftReport,
            };

            if (string.IsNullOrWhiteSpace(deploymentSet.DacPacFilePath) ||
                string.IsNullOrWhiteSpace(deploymentSet.PublishProfileFilePath))
            {
                return;
            }
            btnReport.Enabled      = false;
            btnDriftReport.Enabled = false;
            _reportWorker.RunWorkerAsync(deploymentSet);
        }