public override void CreateVirtualDirectory(WebProject project)
        {
            string name = "/" + project.Name;

            dynamic manager = CreateServerManager();

            if (manager.Sites[DEFAULT_WEB_SITE] != null)
            {
                if (manager.Sites[DEFAULT_WEB_SITE].Applications[name] == null)
                {
                    manager.Sites[DEFAULT_WEB_SITE].Applications.Add(name, project.Directory);
                    manager.CommitChanges();
                }
                else
                {
                    ThrowApplicationExistsException();
                }
            }
            else
            {
                if (manager.Sites[0].Applications[name] == null)
                {
                    manager.Sites[0].Applications.Add(name, project.Directory);
                    manager.CommitChanges();
                }
                else
                {
                    ThrowApplicationExistsException();
                }
            }
            manager.Dispose();
        }
		static string GetSiteName(WebProject project)
		{
			if (project.Name.Contains(" ")) {
				return String.Format("\"{0}\"", project.Name);
			}
			return project.Name;
		}
 static string GetSiteName(WebProject project)
 {
     if (project.Name.Contains(" "))
     {
         return(String.Format("\"{0}\"", project.Name));
     }
     return(project.Name);
 }
Пример #4
0
 bool CheckWebProjectStartInfo()
 {
     if (WebProject.HasWebProjectProperties() && WebProject.GetWebProjectProperties().IsConfigured())
     {
         return(true);
     }
     return(false);
 }
Пример #5
0
 bool CheckWebProjectStartInfo()
 {
     if (WebProject.HasWebProjectProperties() && WebProject.GetWebProjectProperties().IsConfigured())
     {
         return(true);
     }
     MessageService.ShowError("${res:ICSharpCode.WebProjectOptionsPanel.NoProjectUrlOrProgramAction}");
     return(false);
 }
		public override void CreateVirtualDirectory(WebProject project)
		{
			dynamic manager = CreateServerManager();
			dynamic site = manager.Sites.Add(project.Name, project.Directory, Properties.DevelopmentServerPort);
			string bindingInformation = String.Format("*:{0}:localhost", Properties.DevelopmentServerPort);
			site.Bindings[0].BindingInformation = bindingInformation;
			manager.CommitChanges();
			manager.Dispose();
		}
Пример #7
0
        public override void CreateVirtualDirectory(WebProject project)
        {
            dynamic manager            = CreateServerManager();
            dynamic site               = manager.Sites.Add(project.Name, project.Directory, Properties.DevelopmentServerPort);
            string  bindingInformation = String.Format("*:{0}:localhost", Properties.DevelopmentServerPort);

            site.Bindings[0].BindingInformation = bindingInformation;
            manager.CommitChanges();
            manager.Dispose();
        }
Пример #8
0
		public override void CreateVirtualDirectory(WebProject project)
		{
			string error = null;
			var virtualRoot = new IISVirtualRoot();
			virtualRoot.Create(IIS_WEB_LOCATION,
				project.Directory,
				project.Name,
				out error);
			if (!String.IsNullOrEmpty(error)) {
				throw new ApplicationException(error);
			}
		}
        public override void CreateVirtualDirectory(WebProject project)
        {
            string error       = null;
            var    virtualRoot = new IISVirtualRoot();

            virtualRoot.Create(IIS_WEB_LOCATION,
                               project.Directory,
                               project.Name,
                               out error);
            if (!String.IsNullOrEmpty(error))
            {
                throw new ApplicationException(error);
            }
        }
Пример #10
0
		public override void CreateVirtualDirectory(WebProject project)
		{
			string name = "/" + project.Name;
			
			dynamic manager = CreateServerManager();
			
			if (manager.Sites[DEFAULT_WEB_SITE] != null) {
				if (manager.Sites[DEFAULT_WEB_SITE].Applications[name] == null) {
					manager.Sites[DEFAULT_WEB_SITE].Applications.Add(name, project.Directory);
					manager.CommitChanges();
				} else {
					ThrowApplicationExistsException();
				}
			} else {
				if (manager.Sites[0].Applications[name] == null) {
					manager.Sites[0].Applications.Add(name, project.Directory);
					manager.CommitChanges();
				} else {
					ThrowApplicationExistsException();
				}
			}
			manager.Dispose();
		}
Пример #11
0
		void CreateWebProject(MSBuildBasedProject msbuildProject)
		{
			webProject = new WebProject(msbuildProject);
		}
 public static ProcessStartInfo Create(WebProject project)
 {
     return(new ProcessStartInfo(WebProjectService.IISExpressProcessLocation, GetSiteArgument(project)));
 }
Пример #13
0
		public abstract void CreateVirtualDirectory(WebProject project);
		void CreateWebProject(string name)
		{
			string fileName = @"d:\projects\MyProject\MyProject.csproj";
			testableProject = TestableProject.CreateProject(fileName, name);
			project = new WebProject(testableProject);
		}
		public override void CreateVirtualDirectory(WebProject project)
		{
		}
Пример #16
0
        public override void Start(bool withDebugging)
        {
            try {
                WebProjectProperties properties = WebProject.GetWebProjectProperties();
                if (CheckWebProjectStartInfo())
                {
                    AttachToWebWorkerProcessOrStartIISExpress(properties, withDebugging);
                }

                // start default application(e.g. browser) or the one specified
                switch (CompilableProject.StartAction)
                {
                case StartAction.Project:
                    if (FileUtility.IsUrl(properties.IISUrl))
                    {
                        Process.Start(properties.IISUrl);
                    }
                    else
                    {
                        MessageService.ShowError("${res:ICSharpCode.WebProjectOptionsPanel.NoProjectUrlOrProgramAction}");
                        DisposeProcessMonitor();
                    }
                    break;

                case StartAction.Program:
                    ProcessStartInfo processInfo = DotNetStartBehavior.CreateStartInfo(StartProgram, Project.Directory, StartWorkingDirectory, StartArguments);
                    if (withDebugging)
                    {
                        DebuggerService.CurrentDebugger.Start(processInfo);
                    }
                    else
                    {
                        Process.Start(processInfo);
                    }
                    break;

                case StartAction.StartURL:
                    if (FileUtility.IsUrl(StartUrl))
                    {
                        Process.Start(StartUrl);
                    }
                    else
                    {
                        string url = string.Concat(properties.IISUrl, StartUrl);
                        if (FileUtility.IsUrl(url))
                        {
                            Process.Start(url);
                        }
                        else
                        {
                            MessageService.ShowError("${res:ICSharpCode.WebProjectOptionsPanel.NoProjectUrlOrProgramAction}");
                            DisposeProcessMonitor();
                            return;
                        }
                    }
                    break;

                default:
                    throw new Exception("Invalid value for StartAction");
                }
            } catch (Exception ex) {
                MessageService.ShowError(ex.Message);
                LoggingService.Error(ex.ToString());
                DisposeProcessMonitor();
            }
        }
 static string GetSiteArgument(WebProject project)
 {
     return(String.Format("/site:{0}", GetSiteName(project)));
 }
Пример #18
0
 public abstract void CreateVirtualDirectory(WebProject project);
		static string GetSiteArgument(WebProject project)
		{
			return String.Format("/site:{0}", GetSiteName(project));
		}
		public static ProcessStartInfo Create(WebProject project)
		{
			return new ProcessStartInfo(WebProjectService.IISExpressProcessLocation, GetSiteArgument(project));
		}
 public override void CreateVirtualDirectory(WebProject project)
 {
 }
 void CreateWebProject(MSBuildBasedProject project)
 {
     webProject = new WebProject(project);
     properties = webProject.GetWebProjectProperties();
 }
		void CreateWebProject(MSBuildBasedProject project)
		{
			webProject = new WebProject(project);
			properties = webProject.GetWebProjectProperties();
		}
Пример #24
0
        public override void Start(bool withDebugging)
        {
            if (!CheckWebProjectStartInfo())
            {
                return;
            }

            try {
                WebProjectProperties properties = WebProject.GetWebProjectProperties();
                string processName = WebProjectService.GetWorkerProcessName(properties);

                // try find the worker process directly or using the process monitor callback
                Process[] processes = System.Diagnostics.Process.GetProcesses();
                int       index     = processes.FindIndex(p => p.ProcessName.Equals(processName, StringComparison.OrdinalIgnoreCase));
                if (index > -1)
                {
                    if (withDebugging)
                    {
                        DebuggerService.CurrentDebugger.Attach(processes[index]);
                    }
                }
                else
                {
                    if (properties.UseIISExpress)
                    {
                        // start IIS express and attach to it
                        if (WebProjectService.IsIISExpressInstalled)
                        {
                            ProcessStartInfo processInfo = IISExpressProcessStartInfo.Create(WebProject);
                            DebuggerService.CurrentDebugger.Start(processInfo);
                        }
                        else
                        {
                            DisposeProcessMonitor();
                            MessageService.ShowError("${res:ICSharpCode.WebProjectOptionsPanel.NoProjectUrlOrProgramAction}");
                            return;
                        }
                    }
                    else
                    {
                        DisposeProcessMonitor();
                        this.monitor = new ProcessMonitor(processName);
                        this.monitor.ProcessCreated += delegate {
                            WorkbenchSingleton.SafeThreadCall((Action)(() => OnProcessCreated(properties, withDebugging)));
                        };
                        this.monitor.Start();
                    }
                }

                // start default application(e.g. browser) or the one specified
                switch (CompilableProject.StartAction)
                {
                case StartAction.Project:
                    if (FileUtility.IsUrl(properties.IISUrl))
                    {
                        Process.Start(properties.IISUrl);
                    }
                    else
                    {
                        MessageService.ShowError("${res:ICSharpCode.WebProjectOptionsPanel.NoProjectUrlOrProgramAction}");
                        DisposeProcessMonitor();
                    }
                    break;

                case StartAction.Program:
                    Process.Start(StartProgram);
                    break;

                case StartAction.StartURL:
                    if (FileUtility.IsUrl(StartUrl))
                    {
                        Process.Start(StartUrl);
                    }
                    else
                    {
                        string url = string.Concat(properties.IISUrl, StartUrl);
                        if (FileUtility.IsUrl(url))
                        {
                            Process.Start(url);
                        }
                        else
                        {
                            MessageService.ShowError("${res:ICSharpCode.WebProjectOptionsPanel.NoProjectUrlOrProgramAction}");
                            DisposeProcessMonitor();
                            return;
                        }
                    }
                    break;

                default:
                    throw new Exception("Invalid value for StartAction");
                }
            } catch (Exception ex) {
                MessageService.ShowError(ex.Message);
                LoggingService.Error(ex.ToString());
                DisposeProcessMonitor();
            }
        }