public bool IsStartupProjectAvailable()
        {
            NLogService.TraceEnteringMethod();

            ThreadHelper.ThrowIfNotOnUIThread();

            var sb = (SolutionBuild2)_dte.Solution.SolutionBuild;

            return(sb.StartupProjects != null && ((Array)sb.StartupProjects).Cast <string>().Count() > 0);
        }
        public void AttachDebuggerToRunningProcess(DebugOptions debugOptions)
        {
            NLogService.TraceEnteringMethod();

            ThreadHelper.ThrowIfNotOnUIThread();

            MonoEngine.StartupProject = GetStartupProject();

            IntPtr pInfo = GetDebugInfo(debugOptions);
            var    sp    = new ServiceProvider((IServiceProvider)_dte);

            try
            {
                var dbg = sp.GetService(typeof(SVsShellDebugger)) as IVsDebugger;
                if (dbg == null)
                {
                    logger.Error($"GetService did not returned SVsShellDebugger");
                }
                int hr = dbg.LaunchDebugTargets(1, pInfo);
                Marshal.ThrowExceptionForHR(hr);
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                string msg = null;
                var    sh  = sp.GetService(typeof(SVsUIShell)) as IVsUIShell;
                if (sh != null)
                {
                    sh.GetErrorInfo(out msg);
                }
                if (!string.IsNullOrWhiteSpace(msg))
                {
                    logger.Error(msg);
                }
                throw;
            }
            finally
            {
                if (pInfo != IntPtr.Zero)
                {
                    Marshal.FreeCoTaskMem(pInfo);
                }
            }
        }
        public async Task BuildStartupProjectAsync()
        {
            NLogService.TraceEnteringMethod();

            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            var failedBuilds = BuildStartupProject();

            if (failedBuilds > 0)
            {
                Window       window       = _dte.Windows.Item("{34E76E81-EE4A-11D0-AE2E-00A0C90FFFC3}");//EnvDTE.Constants.vsWindowKindOutput
                OutputWindow outputWindow = (OutputWindow)window.Object;
                outputWindow.ActivePane.Activate();
                outputWindow.ActivePane.OutputString($"{failedBuilds} project(s) failed to build. See error and output window!");

                _errorListProvider.Show();

                throw new Exception($"{failedBuilds} project(s) failed to build. See error and output window!");
            }
        }