Browse Source

fix start options for ASp.NET MVC projects

4.1
Eusebiu Marcu 15 years ago
parent
commit
b6fe47b404
  1. 124
      src/AddIns/Debugger/Debugger.AddIn/Service/WindowsDebugger.cs

124
src/AddIns/Debugger/Debugger.AddIn/Service/WindowsDebugger.cs

@ -143,12 +143,12 @@ namespace ICSharpCode.SharpDevelop.Services @@ -143,12 +143,12 @@ namespace ICSharpCode.SharpDevelop.Services
if (FileUtility.IsUrl(processStartInfo.FileName)) {
if (!CheckWebProjectStartInfo())
return;
var project = ProjectService.OpenSolution.StartupProject as CompilableProject;
var options = WebProjectsOptions.Instance.GetWebProjectOptions(project.Name);
System.Diagnostics.Process defaultAppProcess = null;
if (options.Data.WebServer != WebServer.None) {
// we deal with a WebProject
try {
var project = ProjectService.OpenSolution.StartupProject as CompilableProject;
var options = WebProjectsOptions.Instance.GetWebProjectOptions(project.Name);
System.Diagnostics.Process defaultAppProcess = null;
string processName = WebProjectService.WorkerProcessName;
// try find the worker process directly or using the process monitor callback
@ -171,28 +171,50 @@ namespace ICSharpCode.SharpDevelop.Services @@ -171,28 +171,50 @@ namespace ICSharpCode.SharpDevelop.Services
if (options.Data.WebServer == WebServer.IISExpress) {
// start IIS express and attach to it
if (WebProjectService.IISVersion == IISVersion.IISExpress)
if (WebProjectService.IISVersion == IISVersion.IISExpress) {
System.Diagnostics.Process.Start(WebProjectService.IISExpressProcessLocation);
else {
} else {
MessageService.ShowError("${res:ICSharpCode.WepProjectOptionsPanel.NoProjectUrlOrProgramAction}");
return;
}
}
}
// start default application(e.g. browser)
if (project.StartAction == StartAction.StartURL)
defaultAppProcess = System.Diagnostics.Process.Start(project.StartUrl);
else {
if (!string.IsNullOrEmpty(options.Data.ProjectUrl) && options.Data.WebServer == WebServer.IIS)
defaultAppProcess = System.Diagnostics.Process.Start(options.Data.ProjectUrl);
else {
if (options.Data.WebServer == WebServer.IISExpress)
defaultAppProcess = System.Diagnostics.Process.Start(options.Data.ProjectUrl);
// start default application(e.g. browser) or the one specified
switch (project.StartAction) {
case StartAction.Project:
if (FileUtility.IsUrl(options.Data.ProjectUrl)) {
defaultAppProcess = System.Diagnostics.Process.Start(options.Data.ProjectUrl);
} else {
MessageService.ShowError("${res:ICSharpCode.WepProjectOptionsPanel.NoProjectUrlOrProgramAction}");
return;
}
break;
case StartAction.Program:
defaultAppProcess = System.Diagnostics.Process.Start(project.StartProgram);
break;
case StartAction.StartURL:
if (FileUtility.IsUrl(project.StartUrl))
defaultAppProcess = System.Diagnostics.Process.Start(project.StartUrl);
else {
string url = string.Concat(options.Data.ProjectUrl, project.StartUrl);
if (FileUtility.IsUrl(url)) {
defaultAppProcess = System.Diagnostics.Process.Start(url);
} else {
MessageService.ShowError("${res:ICSharpCode.WepProjectOptionsPanel.NoProjectUrlOrProgramAction}");
return;
}
}
break;
default:
throw new System.Exception("Invalid value for StartAction");
}
} catch (System.Exception ex) {
string err = "Error: " + ex.Message;
MessageService.ShowError(err);
LoggingService.Error(err);
return;
}
}
else {
} else {
string version = debugger.GetProgramVersion(processStartInfo.FileName);
if (version.StartsWith("v1.0")) {
@ -301,11 +323,11 @@ namespace ICSharpCode.SharpDevelop.Services @@ -301,11 +323,11 @@ namespace ICSharpCode.SharpDevelop.Services
if (FileUtility.IsUrl(processStartInfo.FileName)) {
if (!CheckWebProjectStartInfo())
return;
var project = ProjectService.OpenSolution.Preferences.StartupProject as CompilableProject;
var options = WebProjectsOptions.Instance.GetWebProjectOptions(project.Name);
if (options.Data.WebServer != WebServer.None) {
// we deal with a WebProject
try {
var project = ProjectService.OpenSolution.StartupProject as CompilableProject;
var options = WebProjectsOptions.Instance.GetWebProjectOptions(project.Name);
string processName = WebProjectService.WorkerProcessName;
if (options.Data.WebServer == WebServer.IISExpress) {
@ -317,23 +339,43 @@ namespace ICSharpCode.SharpDevelop.Services @@ -317,23 +339,43 @@ namespace ICSharpCode.SharpDevelop.Services
return;
}
}
}
// start default application(e.g. browser)
if (project.StartAction == StartAction.StartURL)
System.Diagnostics.Process.Start(project.StartUrl);
else {
if (!string.IsNullOrEmpty(options.Data.ProjectUrl) && options.Data.WebServer == WebServer.IIS)
System.Diagnostics.Process.Start(options.Data.ProjectUrl);
else {
if (!string.IsNullOrEmpty(options.Data.ProjectUrl) && options.Data.WebServer == WebServer.IISExpress)
System.Diagnostics.Process.Start(options.Data.ProjectUrl);
else
System.Diagnostics.Process.Start(processStartInfo.FileName);
// start default application(e.g. browser) or the one specified
switch (project.StartAction) {
case StartAction.Project:
if (FileUtility.IsUrl(options.Data.ProjectUrl)) {
System.Diagnostics.Process.Start(options.Data.ProjectUrl);
} else {
MessageService.ShowError("${res:ICSharpCode.WepProjectOptionsPanel.NoProjectUrlOrProgramAction}");
return;
}
break;
case StartAction.Program:
System.Diagnostics.Process.Start(project.StartProgram);
break;
case StartAction.StartURL:
if (FileUtility.IsUrl(project.StartUrl))
System.Diagnostics.Process.Start(project.StartUrl);
else {
string url = string.Concat(options.Data.ProjectUrl, project.StartUrl);
if (FileUtility.IsUrl(url)) {
System.Diagnostics.Process.Start(url);
} else {
MessageService.ShowError("${res:ICSharpCode.WepProjectOptionsPanel.NoProjectUrlOrProgramAction}");
return;
}
}
break;
default:
throw new System.Exception("Invalid value for StartAction");
}
} catch (System.Exception ex) {
string err = "Error: " + ex.Message;
MessageService.ShowError(err);
LoggingService.Error(err);
return;
}
}
else
} else
System.Diagnostics.Process.Start(processStartInfo);
}

Loading…
Cancel
Save