async Task <BuildResult> OnBuild(ProgressMonitor monitor, ConfigurationSelector configuration)
        {
            if (!project.OnGetNeedsBuilding(configuration))
            {
                monitor.Log.WriteLine(GettextCatalog.GetString("Skipping project since output files are up to date"));
                return(new BuildResult());
            }

            if (!project.TargetRuntime.IsInstalled(project.TargetFramework))
            {
                BuildResult res = new BuildResult();
                res.AddError(GettextCatalog.GetString("Framework '{0}' not installed.", project.TargetFramework.Name));
                return(res);
            }

            bool hasBuildableFiles = false;

            foreach (ProjectFile pf in project.Files)
            {
                if (pf.BuildAction == BuildAction.Compile || pf.BuildAction == BuildAction.EmbeddedResource)
                {
                    hasBuildableFiles = true;
                    break;
                }
            }
            if (!hasBuildableFiles)
            {
                return(new BuildResult());
            }

            if (project.LanguageBinding == null)
            {
                BuildResult langres = new BuildResult();
                string      msg     = GettextCatalog.GetString("Unknown language '{0}'. You may need to install an additional extension to support this language.", project.LanguageName);
                langres.AddError(msg);
                monitor.ReportError(msg, null);
                return(langres);
            }

            BuildResult           refres         = null;
            HashSet <ProjectItem> itemsToExclude = new HashSet <ProjectItem> ();

            foreach (ProjectReference pr in project.References)
            {
                if (pr.ReferenceType == ReferenceType.Project)
                {
                    // Ignore non-dotnet projects
                    Project p = project.ParentSolution != null?pr.ResolveProject(project.ParentSolution) : null;

                    if (p != null && !(p is DotNetProject))
                    {
                        continue;
                    }

                    if (p == null || pr.GetReferencedFileNames(configuration).Length == 0)
                    {
                        if (refres == null)
                        {
                            refres = new BuildResult();
                        }
                        string msg = GettextCatalog.GetString("Referenced project '{0}' not found in the solution.", pr.Reference);
                        monitor.ReportWarning(msg);
                        refres.AddWarning(msg);
                    }
                }

                if (!pr.IsValid)
                {
                    if (refres == null)
                    {
                        refres = new BuildResult();
                    }
                    string msg;
                    if (!pr.IsExactVersion && pr.SpecificVersion)
                    {
                        msg = GettextCatalog.GetString("Reference '{0}' not found on system. Using '{1}' instead.", pr.StoredReference, pr.Reference);
                        monitor.ReportWarning(msg);
                        refres.AddWarning(msg);
                    }
                    else
                    {
                        bool errorsFound = false;
                        foreach (string asm in pr.GetReferencedFileNames(configuration))
                        {
                            if (!File.Exists(asm))
                            {
                                msg = GettextCatalog.GetString("Assembly '{0}' not found. Make sure that the assembly exists in disk. If the reference is required to build the project you may get compilation errors.", Path.GetFileName(asm));
                                refres.AddWarning(msg);
                                monitor.ReportWarning(msg);
                                errorsFound = true;
                                itemsToExclude.Add(pr);
                            }
                        }
                        msg = null;
                        if (!errorsFound)
                        {
                            msg = GettextCatalog.GetString("The reference '{0}' is not valid for the target framework of the project.", pr.StoredReference, pr.Reference);
                            monitor.ReportWarning(msg);
                            refres.AddWarning(msg);
                            itemsToExclude.Add(pr);
                        }
                    }
                }
            }

            DotNetProjectConfiguration conf = (DotNetProjectConfiguration)project.GetConfiguration(configuration);

            // Create a copy of the data needed to compile the project.
            // This data can be modified by extensions.
            // Also filter out items whose condition evaluates to false

            BuildData            buildData = new BuildData();
            ProjectParserContext ctx       = new ProjectParserContext(project, conf);

            buildData.Items = new ProjectItemCollection();
            foreach (ProjectItem item in project.Items)
            {
                if (!itemsToExclude.Contains(item) && (string.IsNullOrEmpty(item.Condition) || ConditionParser.ParseAndEvaluate(item.Condition, ctx)))
                {
                    buildData.Items.Add(item);
                }
            }
            buildData.Configuration = (DotNetProjectConfiguration)project.CloneConfiguration(conf, conf.Id);
            buildData.Configuration.SetParentItem(project);
            buildData.ConfigurationSelector = configuration;

            var br = await project.Compile(monitor, buildData);

            if (refres != null)
            {
                refres.Append(br);
                return(refres);
            }
            else
            {
                return(br);
            }
        }
		internal protected virtual IEnumerable<DotNetProject> OnGetReferencedAssemblyProjects (ConfigurationSelector configuration)
		{
			if (ParentSolution == null) {
				yield break;
			}
			var ctx = new ProjectParserContext (this, (DotNetProjectConfiguration)GetConfiguration (configuration));
			foreach (ProjectReference pref in References) {
				if (pref.ReferenceType == ReferenceType.Project && pref.ReferenceOutputAssembly &&
					(string.IsNullOrEmpty (pref.Condition) || ConditionParser.ParseAndEvaluate (pref.Condition, ctx))) {
					var rp = pref.ResolveProject (ParentSolution) as DotNetProject;
					if (rp != null)
						yield return rp;
				}
			}
		}
		async Task<BuildResult> OnBuild (ProgressMonitor monitor, ConfigurationSelector configuration)
		{
			if (!project.OnGetNeedsBuilding (configuration)) {
				monitor.Log.WriteLine (GettextCatalog.GetString ("Skipping project since output files are up to date"));
				return new BuildResult ();
			}

			if (!project.TargetRuntime.IsInstalled (project.TargetFramework)) {
				BuildResult res = new BuildResult ();
				res.AddError (GettextCatalog.GetString ("Framework '{0}' not installed.", project.TargetFramework.Name));
				return res;
			}
			
			bool hasBuildableFiles = false;
			foreach (ProjectFile pf in project.Files) {
				if (pf.BuildAction == BuildAction.Compile || pf.BuildAction == BuildAction.EmbeddedResource) {
					hasBuildableFiles = true;
					break;
				}
			}
			if (!hasBuildableFiles)
				return new BuildResult ();
			
			if (project.LanguageBinding == null) {
				BuildResult langres = new BuildResult ();
				string msg = GettextCatalog.GetString ("Unknown language '{0}'. You may need to install an additional add-in to support this language.", project.LanguageName);
				langres.AddError (msg);
				monitor.ReportError (msg, null);
				return langres;
			}

			BuildResult refres = null;
			HashSet<ProjectItem> itemsToExclude = new HashSet<ProjectItem> ();
			
			foreach (ProjectReference pr in project.References) {
				
				if (pr.ReferenceType == ReferenceType.Project) {
					// Ignore non-dotnet projects
					Project p = project.ParentSolution != null ? pr.ResolveProject (project.ParentSolution) : null;
					if (p != null && !(p is DotNetProject))
						continue;

					if (p == null || pr.GetReferencedFileNames (configuration).Length == 0) {
						if (refres == null)
							refres = new BuildResult ();
						string msg = GettextCatalog.GetString ("Referenced project '{0}' not found in the solution.", pr.Reference);
						monitor.ReportWarning (msg);
						refres.AddWarning (msg);
					}
				}
				
				if (!pr.IsValid) {
					if (refres == null)
						refres = new BuildResult ();
					string msg;
					if (!pr.IsExactVersion && pr.SpecificVersion) {
						msg = GettextCatalog.GetString ("Reference '{0}' not found on system. Using '{1}' instead.", pr.StoredReference, pr.Reference);
						monitor.ReportWarning (msg);
						refres.AddWarning (msg);
					}
					else {
						bool errorsFound = false;
						foreach (string asm in pr.GetReferencedFileNames (configuration)) {
							if (!File.Exists (asm)) {
								msg = GettextCatalog.GetString ("Assembly '{0}' not found. Make sure that the assembly exists in disk. If the reference is required to build the project you may get compilation errors.", Path.GetFileName (asm));
								refres.AddWarning (msg);
								monitor.ReportWarning (msg);
								errorsFound = true;
								itemsToExclude.Add (pr);
							}
						}
						msg = null;
						if (!errorsFound) {
							msg = GettextCatalog.GetString ("The reference '{0}' is not valid for the target framework of the project.", pr.StoredReference, pr.Reference);
							monitor.ReportWarning (msg);
							refres.AddWarning (msg);
							itemsToExclude.Add (pr);
						}
					}
				}
			}
			
			DotNetProjectConfiguration conf = (DotNetProjectConfiguration) project.GetConfiguration (configuration);

			// Create a copy of the data needed to compile the project.
			// This data can be modified by extensions.
			// Also filter out items whose condition evaluates to false
			
			BuildData buildData = new BuildData ();
			ProjectParserContext ctx = new ProjectParserContext (project, conf);
		
			buildData.Items = new ProjectItemCollection ();
			foreach (ProjectItem item in project.Items) {
				if (!itemsToExclude.Contains (item) && (string.IsNullOrEmpty (item.Condition) || ConditionParser.ParseAndEvaluate (item.Condition, ctx)))
					buildData.Items.Add (item);
			}
			buildData.Configuration = (DotNetProjectConfiguration) project.CloneConfiguration (conf, conf.Id);
			buildData.Configuration.SetParentItem (project);
			buildData.ConfigurationSelector = configuration;

			var br = await project.Compile (monitor, buildData);

			if (refres != null) {
				refres.Append (br);
				return refres;
			} else
				return br;
		}
		protected override IEnumerable<SolutionItem> OnGetReferencedItems (ConfigurationSelector configuration)
		{
			var items = new List<SolutionItem> (base.OnGetReferencedItems (configuration));
			if (ParentSolution == null)
				return items;

			var ctx = new ProjectParserContext (this, (DotNetProjectConfiguration)GetConfiguration (configuration));
			foreach (ProjectReference pref in References) {
				if (pref.ReferenceType == ReferenceType.Project &&
				    (string.IsNullOrEmpty (pref.Condition) || ConditionParser.ParseAndEvaluate (pref.Condition, ctx))) {
					Project rp = pref.ResolveProject (ParentSolution);
					if (rp != null)
						items.Add (rp);
				}
			}
			return items;
		}