Browse Source

Forms designer now tries to find VS designer assemblies if they are required - this fixes problems like SD2-617 (Editing Sql Connection ConnectionString property throws a FileNotFound exception) that only occur when VS is installed.

Run application: If the specified working directory is invalid, display error message to user.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1367 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 19 years ago
parent
commit
a8eba6021a
  1. 32
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Services/TypeResolutionService.cs
  2. 4
      src/Main/Base/Project/Src/Project/MSBuildProject.cs

32
src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Services/TypeResolutionService.cs

@ -17,6 +17,7 @@ using ICSharpCode.SharpDevelop.Project; @@ -17,6 +17,7 @@ using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.Core;
using System.Diagnostics;
using Microsoft.Win32;
namespace ICSharpCode.FormsDesigner.Services
{
@ -339,6 +340,7 @@ namespace ICSharpCode.FormsDesigner.Services @@ -339,6 +340,7 @@ namespace ICSharpCode.FormsDesigner.Services
ICSharpCode.Core.LoggingService.Warn("TODO: Add Assembly reference : " + name);
}
#region VSDesigner workarounds
/// <summary>
/// HACK - Ignore any requests for types from the Microsoft.VSDesigner
/// assembly. There are smart tag problems if data adapter
@ -357,8 +359,38 @@ namespace ICSharpCode.FormsDesigner.Services @@ -357,8 +359,38 @@ namespace ICSharpCode.FormsDesigner.Services
return false;
}
static string vsDesignerIdeDir;
static void RegisterVSDesignerWorkaround()
{
if (vsDesignerIdeDir == null) {
vsDesignerIdeDir = "";
RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\VisualStudio\8.0\Setup\VS");
if (key != null) {
vsDesignerIdeDir = key.GetValue("VS7CommonDir") as string ?? "";
if (vsDesignerIdeDir.Length > 0) {
vsDesignerIdeDir = Path.Combine(vsDesignerIdeDir, "IDE");
AppDomain.CurrentDomain.AssemblyResolve += delegate(object sender, ResolveEventArgs args) {
string shortName = args.Name;
if (shortName.IndexOf(',') >= 0) {
shortName = shortName.Substring(0, shortName.IndexOf(','));
}
if (shortName.StartsWith("Microsoft.")
&& File.Exists(Path.Combine(vsDesignerIdeDir, shortName + ".dll")))
{
return Assembly.LoadFrom(Path.Combine(vsDesignerIdeDir, shortName + ".dll"));
}
return null;
};
}
}
}
}
#endregion
public static void AddAssemblyResolver()
{
RegisterVSDesignerWorkaround();
AppDomain.CurrentDomain.AssemblyResolve += AssemblyResolveEventHandler;
}

4
src/Main/Base/Project/Src/Project/MSBuildProject.cs

@ -353,6 +353,10 @@ namespace ICSharpCode.SharpDevelop.Project @@ -353,6 +353,10 @@ namespace ICSharpCode.SharpDevelop.Project
MessageService.ShowError(psi.FileName + " does not exist and cannot be started.");
return;
}
if (!System.IO.Directory.Exists(psi.WorkingDirectory)) {
MessageService.ShowError("Working directory " + psi.WorkingDirectory + " does not exist; the process cannot be started. You can specify the working directory in the project options.");
return;
}
if (withDebugging) {
DebuggerService.CurrentDebugger.Start(psi);

Loading…
Cancel
Save