Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLluis Sanchez Gual <lluis@xamarin.com>2014-02-24 16:03:41 +0400
committerLluis Sanchez <lluis@xamarin.com>2014-02-27 12:14:13 +0400
commitda9b5936454b9af093f2f0868a8ad73dd5286413 (patch)
treee794b771d7dec819e28353cd2131db5e609eb60a /main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProjectHandler.cs
parent4f2eae547b2b2d91574deba1e33e8db9add77b44 (diff)
[Ide] Allow loading some unsupported projects
Some project types that are known to be unsupported in some platforms can now be partially loaded. The solution pad shows the files of the project, although nothing can really be done with the project.
Diffstat (limited to 'main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProjectHandler.cs')
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProjectHandler.cs56
1 files changed, 32 insertions, 24 deletions
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProjectHandler.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProjectHandler.cs
index 20dc17c31e..3fa6ff8a59 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProjectHandler.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProjectHandler.cs
@@ -72,6 +72,8 @@ namespace MonoDevelop.Projects.Formats.MSBuild
string productVersion;
string schemaVersion;
+ public bool ProjectTypeIsUnsupported { get; set; }
+
public List<string> TargetImports {
get { return targetImports; }
}
@@ -400,8 +402,9 @@ namespace MonoDevelop.Projects.Formats.MSBuild
SolutionItem CreateSolutionItem (IProgressMonitor monitor, MSBuildProject p, string fileName, string language,
string itemType, Type itemClass)
{
- SolutionItem item = null;
-
+ if (ProjectTypeIsUnsupported)
+ return new UnknownProject (fileName);
+
if (subtypeGuids.Any ()) {
DotNetProjectSubtypeNode st = MSBuildProjectService.GetDotNetProjectSubtype (subtypeGuids);
if (st != null) {
@@ -429,35 +432,37 @@ namespace MonoDevelop.Projects.Formats.MSBuild
p.Save (fileName);
}
- item = st.CreateInstance (language);
+ var item = st.CreateInstance (language);
st.UpdateImports ((SolutionEntityItem)item, targetImports);
- } else
- throw new UnknownSolutionItemTypeException (string.Join (";", subtypeGuids));
+ return item;
+ } else {
+ var projectInfo = MSBuildProjectService.GetUnknownProjectTypeInfo (subtypeGuids.ToArray ());
+ if (projectInfo != null && projectInfo.LoadFiles) {
+ ProjectTypeIsUnsupported = true;
+ return new UnknownProject (fileName);
+ }
+ throw new UnknownSolutionItemTypeException (ProjectTypeIsUnsupported ? TypeGuid : string.Join (";", subtypeGuids));
+ }
}
- if (item == null && itemClass != null)
- item = (SolutionItem) Activator.CreateInstance (itemClass);
+ if (itemClass != null)
+ return (SolutionItem) Activator.CreateInstance (itemClass);
- if (item == null && !string.IsNullOrEmpty (language)) {
- item = new DotNetAssemblyProject (language);
-
+ if (!string.IsNullOrEmpty (language)) {
//enable msbuild by default .NET assembly projects
UseMSBuildEngineByDefault = true;
RequireMSBuildEngine = false;
+ return new DotNetAssemblyProject (language);
}
- if (item == null) {
- if (string.IsNullOrEmpty (itemType))
- throw new UnknownSolutionItemTypeException ();
-
- DataType dt = MSBuildProjectService.DataContext.GetConfigurationDataType (itemType);
- if (dt == null)
- throw new UnknownSolutionItemTypeException (itemType);
-
- item = (SolutionItem) Activator.CreateInstance (dt.ValueType);
- }
-
- return item;
+ if (string.IsNullOrEmpty (itemType))
+ throw new UnknownSolutionItemTypeException ();
+
+ DataType dt = MSBuildProjectService.DataContext.GetConfigurationDataType (itemType);
+ if (dt == null)
+ throw new UnknownSolutionItemTypeException (itemType);
+
+ return (SolutionItem) Activator.CreateInstance (dt.ValueType);
}
Type MigrateProject (IProgressMonitor monitor, DotNetProjectSubtypeNode st, MSBuildProject p, string fileName, string language)
@@ -606,7 +611,7 @@ namespace MonoDevelop.Projects.Formats.MSBuild
if (it is ProjectFile) {
var file = (ProjectFile)it;
- if (file.Name.IndexOf ('*') > -1) {
+ if (file.Name.IndexOf ('*') > -1) {
// Thanks to IsOriginatedFromWildcard, these expanded items will not be saved back to disk.
foreach (var expandedItem in ResolveWildcardItems (file))
EntityItem.Items.Add (expandedItem);
@@ -616,7 +621,10 @@ namespace MonoDevelop.Projects.Formats.MSBuild
EntityItem.WildcardItems.Add (it);
continue;
}
- }
+ if (ProjectTypeIsUnsupported && !File.Exists (file.FilePath))
+ continue;
+ } else if (ProjectTypeIsUnsupported)
+ continue;
EntityItem.Items.Add (it);
}