public override Task<SolutionItem> LoadSolutionItem (ProgressMonitor monitor, SolutionLoadContext ctx, string fileName, MSBuildFileFormat expectedFormat, string typeGuid, string itemGuid)
		{
			return Task.Run (() => {
				foreach (var f in MSBuildFileFormat.GetSupportedFormats ()) {
					if (f.CanReadFile (fileName, typeof(SolutionItem)))
						return MSBuildProjectService.LoadItem (monitor, fileName, f, typeGuid, itemGuid, ctx);
				}
				throw new NotSupportedException ();
			});
		}
示例#2
0
 public override System.Threading.Tasks.Task <SolutionItem> LoadSolutionItem(
     ProgressMonitor monitor,
     SolutionLoadContext ctx,
     string fileName,
     MSBuildFileFormat
     expectedFormat,
     string typeGuid,
     string itemGuid)
 {
     return(Task.Run(() => {
         if (CanRead(fileName, typeof(SolutionItem)))
         {
             return MSBuildProjectService.LoadItem(monitor, fileName, MSBuildFileFormat.VS2012, typeGuid, itemGuid, ctx);
         }
         throw new NotSupportedException();
     }));
 }
		public override async Task<SolutionItem> CreateSolutionItem (ProgressMonitor monitor, SolutionLoadContext ctx, string fileName)
		{
			MSBuildProject p = null;
			Project project = null;

			if (!string.IsNullOrEmpty (fileName)) {
				p = await MSBuildProject.LoadAsync (fileName);
				if (ctx != null && ctx.Solution != null) {
					p.EngineManager = ctx.Solution.MSBuildEngineManager;
					p.SolutionDirectory = ctx.Solution.ItemDirectory;
				}
				
				var migrators = MSBuildProjectService.GetMigrableFlavors (p.ProjectTypeGuids);
				if (migrators.Count > 0)
					await MSBuildProjectService.MigrateFlavors (monitor, fileName, Guid, p, migrators);

				var unsupporedFlavor = p.ProjectTypeGuids.FirstOrDefault (fid => !MSBuildProjectService.IsKnownFlavorGuid (fid) && !MSBuildProjectService.IsKnownTypeGuid (fid));
				if (unsupporedFlavor != null) {
					// The project has a flavor that's not supported. Return a fake project (if possible).
					return MSBuildProjectService.CreateUnknownSolutionItem (monitor, fileName, Guid, unsupporedFlavor, null);
				}

				if (MSBuildSupport == MSBuildSupport.NotSupported || MSBuildProjectService.GetMSBuildSupportForFlavors (p.ProjectTypeGuids) == MSBuildSupport.NotSupported)
					p.UseMSBuildEngine = false;

				// Evaluate the project now. If evaluation fails an exception will be thrown, and when that
				// happens the solution will create a placeholder project.
				p.Evaluate ();
			}

			if (project == null)
				project = await base.CreateSolutionItem (monitor, ctx, fileName) as Project;
			
			if (project == null)
				throw new InvalidOperationException ("Project node type is not a subclass of MonoDevelop.Projects.Project");
			
			if (p != null)
				project.SetCreationContext (Project.CreationContext.Create (p, Guid));
			return project;
		}	
示例#4
0
        internal void LoadSolution(Solution sol, SlnFile sln, ProgressMonitor monitor, SolutionLoadContext ctx)
        {
            var version = sln.FormatVersion;

            //Parse the .sln file
            var folder = sol.RootFolder;

            sol.Version = "0.1";             //FIXME:

            monitor.BeginTask("Loading projects ..", sln.Projects.Count + 1);
            Dictionary <string, SolutionFolderItem> items = new Dictionary <string, SolutionFolderItem> ();
            List <string> sortedList = new List <string> ();

            List <Task> loadTasks = new List <Task> ();

            foreach (SlnProject sec in sln.Projects)
            {
                try {
                    // Valid guid?
                    new Guid(sec.TypeGuid);
                } catch (FormatException) {
                    monitor.Step(1);
                    //Use default guid as projectGuid
                    LoggingService.LogDebug(GettextCatalog.GetString(
                                                "Invalid Project type guid '{0}' on line #{1}. Ignoring.",
                                                sec.Id,
                                                sec.Line));
                    continue;
                }

                string projTypeGuid = sec.TypeGuid.ToUpper();
                string projectName  = sec.Name;
                string projectPath  = sec.FilePath;
                string projectGuid  = sec.Id;

                lock (items)
                    sortedList.Add(projectGuid);

                if (projTypeGuid == MSBuildProjectService.FolderTypeGuid)
                {
                    //Solution folder
                    SolutionFolder sfolder = new SolutionFolder();
                    sfolder.Name   = projectName;
                    sfolder.ItemId = projectGuid;

                    DeserializeSolutionItem(monitor, sol, sfolder, sec);

                    foreach (string f in ReadFolderFiles(sec))
                    {
                        sfolder.Files.Add(MSBuildProjectService.FromMSBuildPath(Path.GetDirectoryName(sol.FileName), f));
                    }

                    lock (items)
                        items.Add(projectGuid, sfolder);

                    monitor.Step(1);
                    continue;
                }

                if (projectPath.StartsWith("http://"))
                {
                    monitor.ReportWarning(GettextCatalog.GetString(
                                              "{0}({1}): Projects with non-local source (http://...) not supported. '{2}'.",
                                              sol.FileName, sec.Line, projectPath));
                    monitor.Step(1);
                    continue;
                }

                string path = MSBuildProjectService.FromMSBuildPath(Path.GetDirectoryName(sol.FileName), projectPath);
                if (String.IsNullOrEmpty(path))
                {
                    monitor.ReportWarning(GettextCatalog.GetString(
                                              "Invalid project path found in {0} : {1}", sol.FileName, projectPath));
                    LoggingService.LogWarning(GettextCatalog.GetString(
                                                  "Invalid project path found in {0} : {1}", sol.FileName, projectPath));
                    monitor.Step(1);
                    continue;
                }

                projectPath = Path.GetFullPath(path);

                SolutionItem        item = null;
                Task <SolutionItem> loadTask;
                DateTime            ti = DateTime.Now;

                if (sol.IsSolutionItemEnabled(projectPath))
                {
                    loadTask = Services.ProjectService.ReadSolutionItem(monitor, projectPath, format, projTypeGuid, projectGuid, ctx);
                }
                else
                {
                    loadTask = Task.FromResult <SolutionItem> (new UnloadedSolutionItem()
                    {
                        FileName = projectPath
                    });
                }

                var ft = loadTask.ContinueWith(ta => {
                    try {
                        item = ta.Result;
                        if (item == null)
                        {
                            throw new UnknownSolutionItemTypeException(projTypeGuid);
                        }
                    } catch (Exception cex) {
                        var e = UnwrapException(cex).First();

                        string unsupportedMessage = e.Message;

                        if (e is UserException)
                        {
                            var ex = (UserException)e;
                            LoggingService.LogError("{0}: {1}", ex.Message, ex.Details);
                            monitor.ReportError(string.Format("{0}{1}{1}{2}", ex.Message, Environment.NewLine, ex.Details), null);
                        }
                        else
                        {
                            LoggingService.LogError(string.Format("Error while trying to load the project {0}", projectPath), e);
                            monitor.ReportWarning(GettextCatalog.GetString(
                                                      "Error while trying to load the project '{0}': {1}", projectPath, e.Message));
                        }

                        SolutionItem uitem;
                        uitem = new UnknownSolutionItem()
                        {
                            FileName  = projectPath,
                            LoadError = unsupportedMessage,
                        };
                        item          = uitem;
                        item.ItemId   = projectGuid;
                        item.TypeGuid = projTypeGuid;
                    }

                    item.UnresolvedProjectDependencies = ReadSolutionItemDependencies(sec);

                    // Deserialize the object
                    DeserializeSolutionItem(monitor, sol, item, sec);

                    lock (items) {
                        if (!items.ContainsKey(projectGuid))
                        {
                            items.Add(projectGuid, item);
                        }
                        else
                        {
                            monitor.ReportError(GettextCatalog.GetString("Invalid solution file. There are two projects with the same GUID. The project {0} will be ignored.", projectPath), null);
                        }
                    }
                    monitor.Step(1);
                });
                loadTasks.Add(ft);
            }

            Task.WaitAll(loadTasks.ToArray());

            sol.LoadedProjects = new HashSet <string> (items.Keys);

            var nested = sln.Sections.GetSection("NestedProjects");

            if (nested != null)
            {
                LoadNestedProjects(nested, items, monitor);
            }

            // Resolve project dependencies
            foreach (var it in items.Values.OfType <SolutionItem> ())
            {
                if (it.UnresolvedProjectDependencies != null)
                {
                    foreach (var id in it.UnresolvedProjectDependencies.ToArray())
                    {
                        SolutionFolderItem dep;
                        if (items.TryGetValue(id, out dep) && dep is SolutionItem)
                        {
                            it.UnresolvedProjectDependencies.Remove(id);
                            it.ItemDependencies.Add((SolutionItem)dep);
                        }
                    }
                    if (it.UnresolvedProjectDependencies.Count == 0)
                    {
                        it.UnresolvedProjectDependencies = null;
                    }
                }
            }

            //Add top level folders and projects to the main folder
            foreach (string id in sortedList)
            {
                SolutionFolderItem ce;
                if (items.TryGetValue(id, out ce) && ce.ParentFolder == null)
                {
                    folder.Items.Add(ce);
                }
            }

            //FIXME: This can be just SolutionConfiguration also!
            LoadSolutionConfigurations(sln.SolutionConfigurationsSection, sol, monitor);

            LoadProjectConfigurationMappings(sln.ProjectConfigurationsSection, sol, items, monitor);

            foreach (var e in sln.Sections)
            {
                string name = e.Id;
                if (name.StartsWith("MonoDevelopProperties."))
                {
                    int i = name.IndexOf('.');
                    LoadMonoDevelopConfigurationProperties(name.Substring(i + 1), e, sol, monitor);
                }
            }

            monitor.EndTask();
        }
示例#5
0
 public override Task <SolutionItem> LoadSolutionItem(ProgressMonitor monitor, SolutionLoadContext ctx, string fileName, MSBuildFileFormat expectedFormat, string typeGuid, string itemGuid)
 {
     return(Task.Run(() => (SolutionItem)ReadFile(fileName, false, monitor)));
 }
		internal void LoadSolution (Solution sol, SlnFile sln, ProgressMonitor monitor, SolutionLoadContext ctx)
		{
			var version = sln.FormatVersion;

			//Parse the .sln file
			var folder = sol.RootFolder;
			sol.Version = "0.1"; //FIXME:

			monitor.BeginTask("Loading projects ..", sln.Projects.Count + 1);
			Dictionary<string, SolutionFolderItem> items = new Dictionary<string, SolutionFolderItem> ();
			List<string> sortedList = new List<string> ();

			List<Task> loadTasks = new List<Task> ();

			foreach (SlnProject sec in sln.Projects) {
				try {
					// Valid guid?
					new Guid (sec.TypeGuid);
				} catch (FormatException) {
					monitor.Step (1);
					//Use default guid as projectGuid
					LoggingService.LogDebug (GettextCatalog.GetString (
						"Invalid Project type guid '{0}' on line #{1}. Ignoring.",
						sec.Id,
						sec.Line));
					continue;
				}

				string projTypeGuid = sec.TypeGuid.ToUpper ();
				string projectName = sec.Name;
				string projectPath = sec.FilePath;
				string projectGuid = sec.Id;

				lock (items)
					sortedList.Add (projectGuid);

				if (projTypeGuid == MSBuildProjectService.FolderTypeGuid) {
					//Solution folder
					SolutionFolder sfolder = new SolutionFolder ();
					sfolder.Name = projectName;
					sfolder.ItemId = projectGuid;

					DeserializeSolutionItem (monitor, sol, sfolder, sec);
					
					foreach (string f in ReadFolderFiles (sec))
						sfolder.Files.Add (MSBuildProjectService.FromMSBuildPath (Path.GetDirectoryName (sol.FileName), f));

					lock (items)
						items.Add (projectGuid, sfolder);

					monitor.Step (1);
					continue;
				}

				if (projectPath.StartsWith("http://")) {
					monitor.ReportWarning (GettextCatalog.GetString (
						"{0}({1}): Projects with non-local source (http://...) not supported. '{2}'.",
						sol.FileName, sec.Line, projectPath));
					monitor.Step (1);
					continue;
				}

				string path = MSBuildProjectService.FromMSBuildPath (Path.GetDirectoryName (sol.FileName), projectPath);
				if (String.IsNullOrEmpty (path)) {
					monitor.ReportWarning (GettextCatalog.GetString (
						"Invalid project path found in {0} : {1}", sol.FileName, projectPath));
					LoggingService.LogWarning (GettextCatalog.GetString (
						"Invalid project path found in {0} : {1}", sol.FileName, projectPath));
					monitor.Step (1);
					continue;
				}

				projectPath = Path.GetFullPath (path);
				
				SolutionItem item = null;
				Task<SolutionItem> loadTask;
				DateTime ti = DateTime.Now;

				if (sol.IsSolutionItemEnabled (projectPath)) {
					loadTask = Services.ProjectService.ReadSolutionItem (monitor, projectPath, format, projTypeGuid, projectGuid, ctx);
				} else {
					loadTask = Task.FromResult<SolutionItem> (new UnloadedSolutionItem () {
						FileName = projectPath
					});
				}

				var ft = loadTask.ContinueWith (ta => {
					try {
						item = ta.Result;
						if (item == null)
							throw new UnknownSolutionItemTypeException (projTypeGuid);
					} catch (Exception cex) {
						var e = UnwrapException (cex).First ();

						string unsupportedMessage = e.Message;

						if (e is UserException) {
							var ex = (UserException) e;
							LoggingService.LogError ("{0}: {1}", ex.Message, ex.Details);
							monitor.ReportError (string.Format ("{0}{1}{1}{2}", ex.Message, Environment.NewLine, ex.Details), null);
						} else {
							LoggingService.LogError (string.Format ("Error while trying to load the project {0}", projectPath), e);
							monitor.ReportWarning (GettextCatalog.GetString (
								"Error while trying to load the project '{0}': {1}", projectPath, e.Message));
						}

						SolutionItem uitem;
						uitem = new UnknownSolutionItem () {
							FileName = projectPath,
							LoadError = unsupportedMessage,
						};
						item = uitem;
						item.ItemId = projectGuid;
						item.TypeGuid = projTypeGuid;
					}

					item.UnresolvedProjectDependencies = ReadSolutionItemDependencies (sec);

					// Deserialize the object
					DeserializeSolutionItem (monitor, sol, item, sec);

					lock (items) {
						if (!items.ContainsKey (projectGuid)) {
							items.Add (projectGuid, item);
						} else {
							monitor.ReportError (GettextCatalog.GetString ("Invalid solution file. There are two projects with the same GUID. The project {0} will be ignored.", projectPath), null);
						}
					}
					monitor.Step (1);
				});
				loadTasks.Add (ft);
			}

			Task.WaitAll (loadTasks.ToArray ());

			sol.LoadedProjects = new HashSet<string> (items.Keys);

			var nested = sln.Sections.GetSection ("NestedProjects");
			if (nested != null)
				LoadNestedProjects (nested, items, monitor);

			// Resolve project dependencies
			foreach (var it in items.Values.OfType<SolutionItem> ()) {
				if (it.UnresolvedProjectDependencies != null) {
					foreach (var id in it.UnresolvedProjectDependencies.ToArray ()) {
						SolutionFolderItem dep;
						if (items.TryGetValue (id, out dep) && dep is SolutionItem) {
							it.UnresolvedProjectDependencies.Remove (id);
							it.ItemDependencies.Add ((SolutionItem)dep);
						}
					}
					if (it.UnresolvedProjectDependencies.Count == 0)
						it.UnresolvedProjectDependencies = null;
				}
			}

			//Add top level folders and projects to the main folder
			foreach (string id in sortedList) {
				SolutionFolderItem ce;
				if (items.TryGetValue (id, out ce) && ce.ParentFolder == null)
					folder.Items.Add (ce);
			}

			//FIXME: This can be just SolutionConfiguration also!
			LoadSolutionConfigurations (sln.SolutionConfigurationsSection, sol, monitor);

			LoadProjectConfigurationMappings (sln.ProjectConfigurationsSection, sol, items, monitor);

			foreach (var e in sln.Sections) {
				string name = e.Id;
				if (name.StartsWith ("MonoDevelopProperties.")) {
					int i = name.IndexOf ('.');
					LoadMonoDevelopConfigurationProperties (name.Substring (i+1), e, sol, monitor);
				}
			}

			monitor.EndTask ();
		}
        public virtual async Task <SolutionItem> CreateSolutionItem(ProgressMonitor monitor, SolutionLoadContext ctx, string fileName)
        {
            SolutionItem item;

            if (typeof(SolutionItemFactory).IsAssignableFrom(ItemType))
            {
                if (factory == null)
                {
                    factory = (SolutionItemFactory)Activator.CreateInstance(ItemType);
                }
                item = await factory.CreateItem(fileName, Guid).ConfigureAwait(false);
            }
            else
            {
                item = MSBuildProjectService.CreateUninitializedInstance(ItemType);
            }

            item.TypeGuid = Guid;
            return(item);
        }
		public virtual async Task<SolutionItem> CreateSolutionItem (ProgressMonitor monitor, SolutionLoadContext ctx, string fileName)
		{
			SolutionItem item;

			if (typeof(SolutionItemFactory).IsAssignableFrom (ItemType)) {
				if (factory == null)
					factory = (SolutionItemFactory)Activator.CreateInstance (ItemType);
				item = await factory.CreateItem (fileName, Guid);
			} else
				item = MSBuildProjectService.CreateUninitializedInstance (ItemType);
			
			item.TypeGuid = Guid;
			return item;
		}
		public virtual Task<SolutionItem> LoadSolutionItem (ProgressMonitor monitor, SolutionLoadContext ctx, string fileName, MSBuildFileFormat expectedFormat, string typeGuid, string itemGuid)
		{
			throw new NotSupportedException ();
		}
示例#10
0
		public async Task<SolutionItem> ReadSolutionItem (ProgressMonitor monitor, string file)
		{
			using (var ctx = new SolutionLoadContext (null))
				return await ReadSolutionItem (monitor, file, null, null, null, ctx);
		}
		public override Task<SolutionItem> LoadSolutionItem (ProgressMonitor monitor, SolutionLoadContext ctx, string fileName, MSBuildFileFormat expectedFormat, string typeGuid, string itemGuid)
		{
			return Task.Run (() => (SolutionItem) ReadFile (fileName, false, monitor));
		}
 public override Task <SolutionItem> LoadSolutionItem(ProgressMonitor monitor, SolutionLoadContext ctx,
                                                      string fileName, MSBuildFileFormat expectedFormat,
                                                      string typeGuid, string itemGuid)
 {
     return(Task <SolutionItem> .Factory.StartNew(delegate {
         CMakeProject p = new CMakeProject();
         p.LoadFrom(fileName);
         return p;
     }));
 }
示例#13
0
        public override async Task <SolutionItem> CreateSolutionItem(ProgressMonitor monitor, SolutionLoadContext ctx, string fileName)
        {
            MSBuildProject p       = null;
            Project        project = null;

            if (!string.IsNullOrEmpty(fileName))
            {
                p = await MSBuildProject.LoadAsync(fileName);

                if (ctx != null && ctx.Solution != null)
                {
                    p.EngineManager     = ctx.Solution.MSBuildEngineManager;
                    p.SolutionDirectory = ctx.Solution.ItemDirectory;
                }

                var migrators = MSBuildProjectService.GetMigrableFlavors(p.ProjectTypeGuids);
                if (migrators.Count > 0)
                {
                    await MSBuildProjectService.MigrateFlavors(monitor, fileName, Guid, p, migrators);
                }

                var unsupporedFlavor = p.ProjectTypeGuids.FirstOrDefault(fid => !MSBuildProjectService.IsKnownFlavorGuid(fid) && !MSBuildProjectService.IsKnownTypeGuid(fid));
                if (unsupporedFlavor != null)
                {
                    // The project has a flavor that's not supported. Return a fake project (if possible).
                    return(MSBuildProjectService.CreateUnknownSolutionItem(monitor, fileName, Guid, unsupporedFlavor, null));
                }

                                #pragma warning disable 612
                p.UseMSBuildEngine = MSBuildSupport != MSBuildSupport.NotSupported &&
                                     MSBuildProjectService.GetMSBuildSupportForFlavors(p.ProjectTypeGuids);
                                #pragma warning restore 612

                // Evaluate the project now. If evaluation fails an exception will be thrown, and when that
                // happens the solution will create a placeholder project.
                p.Evaluate();
            }

            if (project == null)
            {
                project = await base.CreateSolutionItem(monitor, ctx, fileName) as Project;
            }

            if (project == null)
            {
                throw new InvalidOperationException("Project node type is not a subclass of MonoDevelop.Projects.Project");
            }

            if (p != null)
            {
                project.SetCreationContext(Project.CreationContext.Create(p, Guid));
            }
            return(project);
        }
		public override Task<SolutionItem> LoadSolutionItem (ProgressMonitor monitor, SolutionLoadContext ctx, string fileName, MSBuildFileFormat expectedFormat, string typeGuid, string itemGuid)
		{
			return Task<SolutionItem>.Factory.StartNew (delegate {
				CompiledAssemblyProject p = new CompiledAssemblyProject ();
				p.LoadFrom (fileName);
				return p;
			});
		}
		/// <summary>
		/// Loads a solution item
		/// </summary>
		/// <returns>The item.</returns>
		/// <param name="monitor">Progress monitor</param>
		/// <param name="fileName">File path to the item file</param>
		/// <param name="expectedFormat">File format that the project should have</param>
		/// <param name="typeGuid">Optional item type GUID. If not provided, the type is guessed from the file extension.</param>
		/// <param name="itemGuid">Optional item Id</param>
		/// <param name="ctx">Optional solution context</param>
		public async static Task<SolutionItem> LoadItem (ProgressMonitor monitor, string fileName, MSBuildFileFormat expectedFormat, string typeGuid, string itemGuid, SolutionLoadContext ctx)
		{
			SolutionItem item = null;

			// Find an extension node that can handle this item type
			var node = GetItemTypeNodes ().FirstOrDefault (n => n.CanHandleFile (fileName, typeGuid));

			if (node != null) {
				item = await node.CreateSolutionItem (monitor, ctx, fileName);
				if (item == null)
					return null;
			}

			if (item == null) {
				// If it is a known unsupported project, load it as UnknownProject
				item = CreateUnknownSolutionItem (monitor, fileName, typeGuid, typeGuid, ctx);
				if (item == null)
					return null;
			}

			item.EnsureInitialized ();

			item.BeginLoad ();
			ctx.LoadCompleted += delegate {
				item.EndLoad ();
				item.NotifyItemReady ();
			};

			await item.LoadAsync (monitor, fileName, expectedFormat);
			return item;
		}
示例#16
0
		public Task<SolutionItem> ReadSolutionItem (ProgressMonitor monitor, string file, MSBuildFileFormat format, string typeGuid = null, string itemGuid = null, SolutionLoadContext ctx = null)
		{
			return Runtime.RunInMainThread (async delegate {
				if (!File.Exists (file))
					throw new IOException (GettextCatalog.GetString ("File not found: {0}", file));
				file = Path.GetFullPath (file);
				using (Counters.ReadSolutionItem.BeginTiming ("Read project " + file)) {
					file = GetTargetFile (file);
					var r = GetObjectReaderForFile (file, typeof(SolutionItem));
					if (r == null)
						throw new UnknownSolutionItemTypeException ();
					SolutionItem loadedItem = await r.LoadSolutionItem (monitor, ctx, file, format, typeGuid, itemGuid);
					if (loadedItem != null)
						loadedItem.NeedsReload = false;
					return loadedItem;
				}
			});
		}
		internal static SolutionItem CreateUnknownSolutionItem (ProgressMonitor monitor, string fileName, string typeGuid, string unknownTypeGuid, SolutionLoadContext ctx)
		{
			bool loadAsProject = false;
			string unsupportedMessage;

			var relPath = ctx != null && ctx.Solution != null ? new FilePath (fileName).ToRelative (ctx.Solution.BaseDirectory).ToString() : new FilePath (fileName).FileName;
			var guids = !string.IsNullOrEmpty (unknownTypeGuid) ? unknownTypeGuid.Split (new char[] {';'}, StringSplitOptions.RemoveEmptyEntries) : new string[0];

			if (!string.IsNullOrEmpty (unknownTypeGuid)) {
				var projectInfo = MSBuildProjectService.GetUnknownProjectTypeInfo (guids, fileName);
				if (projectInfo != null) {
					loadAsProject = projectInfo.LoadFiles;
					unsupportedMessage = projectInfo.GetInstructions ();
					LoggingService.LogWarning (string.Format ("Could not load {0} project '{1}'. {2}", projectInfo.Name, relPath, projectInfo.GetInstructions ()));
					monitor.ReportWarning (GettextCatalog.GetString ("Could not load {0} project '{1}'. {2}", projectInfo.Name, relPath, projectInfo.GetInstructions ()));
				} else {
					unsupportedMessage = GettextCatalog.GetString ("Unknown project type: {0}", unknownTypeGuid);
					LoggingService.LogWarning (string.Format ("Could not load project '{0}' with unknown item type '{1}'", relPath, unknownTypeGuid));
					monitor.ReportWarning (GettextCatalog.GetString ("Could not load project '{0}' with unknown item type '{1}'", relPath, unknownTypeGuid));
					return null;
				}
			} else {
				unsupportedMessage = GettextCatalog.GetString ("Unknown project type");
				LoggingService.LogWarning (string.Format ("Could not load project '{0}' with unknown item type", relPath));
				monitor.ReportWarning (GettextCatalog.GetString ("Could not load project '{0}' with unknown item type", relPath));
			}
			if (loadAsProject) {
				var project = (Project) CreateUninitializedInstance (typeof(UnknownProject));
				project.UnsupportedProjectMessage = unsupportedMessage;
				project.SetCreationContext (Project.CreationContext.Create (typeGuid, new string[0]));
				return project;
			} else
				return null;
		}
        public override Task <SolutionItem> LoadSolutionItem(ProgressMonitor monitor, SolutionLoadContext ctx, string fileName, MSBuildFileFormat expectedFormat, string typeGuid, string itemGuid)
        {
            return(Task.Run(() => {
                if (CanRead(fileName, typeof(SolutionItem)))
                {
                    DotNetCoreSdk.EnsureInitialized();
                    return MSBuildProjectService.LoadItem(monitor, fileName, MSBuildFileFormat.VS2017, typeGuid, itemGuid, ctx);
                }

                throw new NotSupportedException();
            }));
        }