Esempio n. 1
0
        internal static void PerformDeploymentOperation(DTE dte, List <Project> projects, string operation)
        {
            List <SharePointDeploymentJob> wspFiles = new List <SharePointDeploymentJob>();

            foreach (Project project in projects)
            {
                SharePointDeploymentJob job = new SharePointDeploymentJob();
                job.WSPName             = GetWSPName(dte, project);
                job.WSPFilename         = GetWSPFilePath(dte, project);
                job.TargetSiteUrl       = GetSiteUrl(dte, project);
                job.IsSandBoxedSolution = Helpers.GetIsSandboxedSolution(project);

                if (!File.Exists(job.WSPFilename))
                {
                    Helpers.LogMessage(dte, dte, "Error: WSP file not found for project '" + project.Name + "' finished (using '" + job.WSPFilename + "')");
                }
                else
                {
                    wspFiles.Add(job);
                }
            }
            if (wspFiles.Count > 0)
            {
                WorkerObject workerObject = new WorkerObject();
                workerObject.DTE       = dte;
                workerObject.Operation = operation;
                workerObject.WSPFiles  = wspFiles;

                worker = new BackgroundWorker();
                worker.ProgressChanged    += new ProgressChangedEventHandler(worker_ProgressChanged);
                worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted);
                worker.DoWork             += new DoWorkEventHandler(worker_DoWork);
                worker.RunWorkerAsync(workerObject);
            }
        }
        internal static void PerformDeploymentOperation(DTE dte, List<Project> projects, string operation)
        {
            List<SharePointDeploymentJob> wspFiles = new List<SharePointDeploymentJob>();
            foreach (Project project in projects)
            {
                SharePointDeploymentJob job = new SharePointDeploymentJob();
                job.WSPName = GetWSPName(dte, project);
                job.WSPFilename = GetWSPFilePath(dte, project);
                job.TargetSiteUrl = GetSiteUrl(dte, project);
                job.IsSandBoxedSolution = Helpers.GetIsSandboxedSolution(project);

                if (!File.Exists(job.WSPFilename))
                {
                    Helpers.LogMessage(dte, dte, "Error: WSP file not found for project '" + project.Name + "' finished (using '" + job.WSPFilename + "')");
                }
                else
                {
                    wspFiles.Add(job);
                }
            }
            if (wspFiles.Count > 0)
            {
                WorkerObject workerObject = new WorkerObject();
                workerObject.DTE = dte;
                workerObject.Operation = operation;
                workerObject.WSPFiles = wspFiles;

                worker = new BackgroundWorker();
                worker.ProgressChanged += new ProgressChangedEventHandler(worker_ProgressChanged);
                worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted);
                worker.DoWork += new DoWorkEventHandler(worker_DoWork);
                worker.RunWorkerAsync(workerObject);                             
            }
        }
        static void startNewProcessFullDeployWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            if (e.Argument is Project)
            {
                Project project = e.Argument as Project;

                string debuggingWebApp = DeploymentHelpers.GetSiteUrl(project.DTE, project);
                string appPoolOfWebApp = GetAppPoolOfWebApp(project.DTE, debuggingWebApp);
                string startupUrl = DeploymentHelpers.GetStartupUrl(project.DTE, project);

                List<SharePointDeploymentJob> jobs = new List<SharePointDeploymentJob>();
                SharePointDeploymentJob job = new SharePointDeploymentJob();
                job.WSPName = DeploymentHelpers.GetWSPName(project.DTE, project);
                job.WSPFilename = DeploymentHelpers.GetWSPFilePath(project.DTE, project);
                job.TargetSiteUrl = debuggingWebApp;
                jobs.Add(job);
                new SharePointBrigdeHelper(project.DTE).PerformDeploymentOperation("redeploy", jobs);


                Helpers.RefreshServer(project.DTE, debuggingWebApp);
                Helpers.AttachProjectToW3WP(project.DTE, project, appPoolOfWebApp);
                Helpers.OpenWebPage(project.DTE, startupUrl);
            }
        }