static public void Deploy (AspNetAppProject project, ICollection<WebDeployTarget> targets, ConfigurationSelector configuration)
		{
			//project needs to be built before it can be deployed
			IdeApp.ProjectOperations.Build (project);
			
			//set up and launch a copying thread
			DeployThreadParams threadParams = new DeployThreadParams ();
			threadParams.Context = new DeployContext (new WebDeployResolver (), null, null);
			threadParams.Files = MonoDevelop.Deployment.DeployService.GetDeployFiles (threadParams.Context,
			                                                                          project, configuration);
			
			Dictionary<string, string> taskAliases = new Dictionary<string,string> ();
			foreach (WebDeployTarget target in targets) {
				threadParams.Targets.Add ((WebDeployTarget) target.Clone ());
				taskAliases.Add (target.LocationName, target.GetMarkup ());
			}
			
			MultiTaskDialogProgressMonitor monitor = new MultiTaskDialogProgressMonitor (true, true, true, taskAliases);
			monitor.SetDialogTitle (MonoDevelop.Core.GettextCatalog.GetString ("Web Deployment Progress"));
			monitor.SetOperationTitle (MonoDevelop.Core.GettextCatalog.GetString ("Deploying {0}...", project.Name));
			threadParams.Monitor = monitor;
			
			Thread deployThread = new Thread (new ParameterizedThreadStart (DoDeploy));
			deployThread.Name = "Web deploy";
			deployThread.Start (threadParams);
		}
Ejemplo n.º 2
0
        static public void Deploy(AspNetAppProject project, ICollection <WebDeployTarget> targets, ConfigurationSelector configuration)
        {
            //project needs to be built before it can be deployed
            IdeApp.ProjectOperations.Build(project);

            //set up and launch a copying thread
            DeployThreadParams threadParams = new DeployThreadParams();

            threadParams.Context = new DeployContext(new WebDeployResolver(), null, null);
            threadParams.Files   = MonoDevelop.Deployment.DeployService.GetDeployFiles(threadParams.Context,
                                                                                       project, configuration);

            Dictionary <string, string> taskAliases = new Dictionary <string, string> ();

            foreach (WebDeployTarget target in targets)
            {
                threadParams.Targets.Add((WebDeployTarget)target.Clone());
                taskAliases.Add(target.LocationName, target.GetMarkup());
            }

            var monitor = new MultiTaskDialogProgressMonitor(true, true, true, taskAliases);

            monitor.SetDialogTitle(MonoDevelop.Core.GettextCatalog.GetString("Web Deployment Progress"));
            monitor.SetOperationTitle(MonoDevelop.Core.GettextCatalog.GetString("Deploying {0}...", project.Name));
            threadParams.Monitor = monitor;

            Thread deployThread = new Thread(new ParameterizedThreadStart(DoDeploy));

            deployThread.Name = "Web deploy";
            deployThread.Start(threadParams);
        }
Ejemplo n.º 3
0
        static void DoDeploy(object o)
        {
            DeployThreadParams threadParams = (DeployThreadParams)o;

            try {
                IFileReplacePolicy replacePolicy = new DialogFileReplacePolicy();

                foreach (WebDeployTarget target in threadParams.Targets)
                {
                    if (threadParams.Monitor.IsCancelRequested)
                    {
                        break;
                    }
                    try {
                        target.FileCopier.CopyFiles(threadParams.Monitor, replacePolicy,
                                                    threadParams.Files, threadParams.Context);
                    }
                    catch (OperationCanceledException ex) {
                        threadParams.Monitor.ReportError(GettextCatalog.GetString("Web deploy aborted."), ex);
                        break;
                    }
                    catch (InvalidOperationException ex) {
                        threadParams.Monitor.ReportError(GettextCatalog.GetString("Web deploy aborted."), ex);
                        break;
                    }
                }
            } catch (Exception e) {
                MonoDevelop.Core.LoggingService.LogError("Unhandled exception in the web deploy thread", e);
                MonoDevelop.Ide.MessageService.ShowException(e, "Web deploy failed due to unhandled exception");
            } finally {
                threadParams.Monitor.Dispose();
            }
        }