Example #1
0
        public static List <string> GetOutputWindowsLines(this VisualStudioHost host)
        {
            if (host == null)
            {
                throw new ArgumentNullException(nameof(host));
            }

            var lines = new List <string>();

            try
            {
                CommonUtility.UIInvoke(() =>
                {
                    var outputPane = host.ObjectModel.Shell.ToolWindows.OutputWindow.GetOutputPane(_nugetOutputWindowGuid);
                    lines.AddRange(outputPane.Text.Split('\n').Select(e => e.Trim()).Where(e => !string.IsNullOrEmpty(e)));
                });
            }
            catch (ArgumentException)
            {
                // If no output has been printed into the nuget output window then the output pane will not be initialized
                // If no output has been printed we know there is no error in the output window.
            }

            return(lines);
        }
Example #2
0
 public static void SelectProjectInSolutionExplorer(this VisualStudioHost host, string project)
 {
     CommonUtility.UIInvoke(() =>
     {
         var item = host.ObjectModel.Shell.ToolWindows.SolutionExplorer.FindItemRecursive(project);
         item.Select();
     });
 }
Example #3
0
        /// <summary>
        /// Assert no errors in the error list
        /// </summary>
        internal static List <string> GetErrorListErrors(this VisualStudioHost host)
        {
            var errors = new List <string>();

            CommonUtility.UIInvoke(() =>
            {
                errors.AddRange(host.ObjectModel.Shell.ToolWindows.ErrorList.Messages.Select(e => e.Description));
            });

            return(errors);
        }
Example #4
0
 public static void ClearErrorWindow(this VisualStudioHost host)
 {
     try
     {
         CommonUtility.UIInvoke(() => host.ObjectModel.Shell.ToolWindows.ErrorList.HideAllItems());
     }
     catch (ArgumentException)
     {
         // ignore errors
     }
 }
Example #5
0
 public static void ClearOutputWindow(this VisualStudioHost host)
 {
     try
     {
         CommonUtility.UIInvoke(() =>
         {
             var outputPane = host.ObjectModel.Shell.ToolWindows.OutputWindow.GetOutputPane(_nugetOutputWindowGuid);
             outputPane.Clear();
         });
     }
     catch (ArgumentException)
     {
         // if outputPane doesn't exist, ignore it
     }
 }