private void RemoveNUnitPackages(DTEProject selectedProject, StatusbarContext statusbar, ref int complete, int total)
        {
            if (m_options.UninstallNUnitPackages && m_options.NUnitPackages?.Length > 0)
            {
                OutputMessage("Removing NUnit packages", statusbar, ++complete, total);
                using (var packageInstaller = PackageHandler.CreateHosted(selectedProject, m_outputWindowPane))
                {
                    packageInstaller.ReportWarning = msg =>
                    {
                        var diag = Diagnostic.Create(DiagnosticsDescriptors.CannotRemovePackage, Location.None, msg);
                        m_errorListProvider.AddTask(diag, selectedProject);
                    };

                    foreach (var package in m_options.NUnitPackages)
                    {
                        packageInstaller.RemovePackage(package.Trim());
                    }
                }
            }
        }
示例#2
0
        void Add(Project project, ErrorTask task)
        {
            IVsHierarchy hierarchy = null;

            if (project != null && ServiceProvider != null)
            {
                var solution = ServiceProvider.GetService(typeof(IVsSolution)) as IVsSolution;
                if (solution != null)
                {
                    solution.GetProjectOfUniqueName(project.UniqueName, out hierarchy);
                }
            }

            task.HierarchyItem = hierarchy;
            task.Navigate     += Navigate;

            if (ErrorListProvider != null)
            {
                ErrorListProvider.AddTask(task);
            }

            Tasks.Add(task);

            if (project != null)
            {
                lock (TaskProjects)
                {
                    TaskProjects.Add(task, project);
                }
            }

            if (App != null && App.ToolWindows != null)
            {
                App.ToolWindows.ErrorList.Parent.Activate();
            }
        }