Browse Source

Show better error message when Forms Designer is used and the reference to System.Windows.Forms is missing (SD2-1211)

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.1@2205 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 19 years ago
parent
commit
e368ce2301
  1. 15
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerLoader/NRefactoryDesignerLoader.cs

15
src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerLoader/NRefactoryDesignerLoader.cs

@ -175,6 +175,21 @@ namespace ICSharpCode.FormsDesigner @@ -175,6 +175,21 @@ namespace ICSharpCode.FormsDesigner
bool isFirstClassInFile;
IList<IClass> parts = FindFormClassParts(parseInfo, out formClass, out isFirstClassInFile);
const string missingReferenceMessage = "Your project is missing a reference to '${Name}' - please add it using 'Project > Add Reference'.";
if (formClass.ProjectContent.GetClass("System.Drawing.Point", 0) == null) {
throw new FormsDesignerLoadException(
StringParser.Parse(
missingReferenceMessage, new string[,] {{ "Name" , "System.Drawing"}}
));
}
if (formClass.ProjectContent.GetClass("System.Windows.Forms.Form", 0) == null) {
throw new FormsDesignerLoadException(
StringParser.Parse(
missingReferenceMessage, new string[,] {{ "Name" , "System.Windows.Forms"}}
));
}
List<KeyValuePair<string, CompilationUnit>> compilationUnits = new List<KeyValuePair<string, CompilationUnit>>();
bool foundInitMethod = false;
foreach (IClass part in parts) {

Loading…
Cancel
Save