/// <summary>
        /// Sets up the build system in preparation for a build operation (clean, build, rebuild) and calls
        /// the operation delegate at the appropriate place. This also handles any errors that occur and
        /// makes sure the build isn't in a weird state.
        /// </summary>
        /// <param name="outputPane">The window to output build messages to.</param>
        /// <param name="operationDelegate">The method to call after setup has occurred and before cleanup.</param>
        /// <returns>true if the operation was successful; otherwise, false.</returns>
        private bool BuildOperation(IVsOutputWindowPane outputPane, InternalBuildOperation operationDelegate)
        {
            Tracer.VerifyNonNullArgument(outputPane, "outputPane");

            if (!this.PrepareBuild(outputPane))
            {
                return(false);
            }

            bool successful = false;

            try
            {
                successful = operationDelegate(outputPane);
            }
            catch (Exception e)
            {
                if (ErrorUtility.IsExceptionUnrecoverable(e))
                {
                    throw;
                }

                this.WriteLineToOutputWindow("There was an error while building the project.");

                // Append the "Consult the trace log message"
                string message = String.Empty;
                PackageUtility.AppendConsultTraceMessage(ref message);
                if (!String.IsNullOrEmpty(message))
                {
                    this.WriteLineToOutputWindow(message);
                }

                this.WriteLineToOutputWindow("Exception: {0}", e);
                this.WriteLineToOutputWindow();

                successful = false;
            }
            finally
            {
                this.FinishBuild(successful);
            }

            return(successful);
        }
        /// <summary>
        /// Sets up the build system in preparation for a build operation (clean, build, rebuild) and calls
        /// the operation delegate at the appropriate place. This also handles any errors that occur and
        /// makes sure the build isn't in a weird state.
        /// </summary>
        /// <param name="outputPane">The window to output build messages to.</param>
        /// <param name="operationDelegate">The method to call after setup has occurred and before cleanup.</param>
        /// <returns>true if the operation was successful; otherwise, false.</returns>
        private bool BuildOperation(IVsOutputWindowPane outputPane, InternalBuildOperation operationDelegate)
        {
            Tracer.VerifyNonNullArgument(outputPane, "outputPane");

            if (!this.PrepareBuild(outputPane))
            {
                return false;
            }

            bool successful = false;

            try
            {
                successful = operationDelegate(outputPane);
            }
            catch (Exception e)
            {
                if (ErrorUtility.IsExceptionUnrecoverable(e))
                {
                    throw;
                }

                this.WriteLineToOutputWindow("There was an error while building the project.");

                // Append the "Consult the trace log message"
                string message = String.Empty;
                PackageUtility.AppendConsultTraceMessage(ref message);
                if (!String.IsNullOrEmpty(message))
                {
                    this.WriteLineToOutputWindow(message);
                }

                this.WriteLineToOutputWindow("Exception: {0}", e);
                this.WriteLineToOutputWindow();

                successful = false;
            }
            finally
            {
                this.FinishBuild(successful);
            }

            return successful;
        }