protected override BuildResult Build(IProgressMonitor monitor, SolutionEntityItem entry, ConfigurationSelector configuration)
        {
            DotNetProject project = (DotNetProject)entry;
            GtkDesignInfo info    = GtkDesignInfo.FromProject(project);

            // The code generator must run in the GUI thread since it needs to
            // access to Gtk classes
            Generator gen = new Generator();

            lock (gen) {
                Gtk.Application.Invoke(delegate { gen.Run(monitor, project, configuration); });
                Monitor.Wait(gen);
            }

            BuildResult res = base.Build(monitor, entry, configuration);

            if (gen.Messages != null)
            {
                foreach (string s in gen.Messages)
                {
                    res.AddWarning(info.GuiBuilderProject.File, 0, 0, null, s);
                }

                if (gen.Messages.Length > 0)
                {
                    info.ForceCodeGenerationOnBuild();
                }
            }
            return(res);
        }
        protected override BuildResult Build(IProgressMonitor monitor, SolutionEntityItem entry, ConfigurationSelector configuration)
        {
            DotNetProject project = (DotNetProject)entry;
            GtkDesignInfo info    = GtkDesignInfo.FromProject(project);

            // The code generator must run in the GUI thread since it needs to
            // access to Gtk classes
            Generator gen = new Generator();

            lock (gen)
            {
                Gtk.Application.Invoke(delegate
                {
                    gen.Run(monitor, project, configuration);
                });
                Monitor.Wait(gen);
            }

            BuildResult res = base.Build(monitor, entry, configuration);

            if (gen.Messages != null)
            {
                foreach (string s in gen.Messages)
                {
                    res.AddWarning(info.GuiBuilderProject.File, 0, 0, null, s);
                }

                if (gen.Messages.Length > 0)
                {
                    info.ForceCodeGenerationOnBuild();
                }
            }

            if (res.Failed && !Platform.IsWindows && !Platform.IsMac)
            {
                // Some gtk# packages don't include the .pc file unless you install gtk-sharp-devel
                if (project.AssemblyContext.GetPackage("gtk-sharp-2.0") == null)
                {
                    string msg = GettextCatalog.GetString(
                        "ERROR: MonoDevelop could not find the Gtk# 2.0 development package. " +
                        "Compilation of projects depending on Gtk# libraries will fail. " +
                        "You may need to install development packages for gtk-sharp-2.0.");
                    monitor.Log.WriteLine();
                    monitor.Log.WriteLine(msg);
                }
            }

            return(res);
        }