private void ShowToolWindow(object sender, EventArgs e)
        {
            var targetNamesCount = new SortedDictionary <string, int>();
            var selectedProjects = new List <EnvDTE.Project>();

            var projCount = _dte.SelectedItems.Count;

            for (var k = 1; k <= projCount; k++) //Iterate through all selected items
            {
                var selectedProject = _dte.SelectedItems.Item(k).Project;
                selectedProjects.Add(selectedProject); //Add to selectedProjects

                var evalProject = ProjectCollection.GlobalProjectCollection.LoadProject(selectedProject.FullName);
                var execProject = evalProject.CreateProjectInstance();

                foreach (var target in execProject.Targets)
                {
                    //Ignore standard targets as we dont want to display a huge target list
                    var ignoreFolders = new[] {
                        Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "Microsoft.NET"),
                        Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles)
                    };
                    var targetFilePath = Path.GetDirectoryName(target.Value.FullPath);

                    if (ignoreFolders.Any(t => Helpers.IsPathSubpathOf(t, targetFilePath)))
                    {
                        continue;
                    }

                    var targetName = $"{target.Value.Name}";

                    if (targetNamesCount.ContainsKey(targetName))
                    {
                        targetNamesCount[targetName]++;
                    }
                    else
                    {
                        targetNamesCount[targetName] = 1;
                    }
                }
            }

            var commonTargets = targetNamesCount.Where(t => t.Value == projCount).Select(t => t.Key);

            var selectTargetsWindow = new SelectTargetsWindow {
                DataContext = this
            };

            foreach (var item in commonTargets)
            {
                selectTargetsWindow.ItemsComboBox.Items.Add(item);
            }
            selectTargetsWindow.ItemsComboBox.SelectedIndex = 0;

            if (selectTargetsWindow.ShowDialog() == true)
            {
                var targetName = (string)selectTargetsWindow.ItemsComboBox.SelectedItem;

                var previousCursor = Mouse.OverrideCursor;
                Mouse.OverrideCursor = Cursors.Wait;
                System.Threading.Tasks.Task.Run(() =>
                {
                    ExecuteTarget(selectedProjects, targetName);
                }).ContinueWith(t =>
                {
                    Mouse.OverrideCursor = previousCursor;
                }, System.Threading.Tasks.TaskScheduler.FromCurrentSynchronizationContext());
            }
        }
        private void ShowToolWindow(object sender, EventArgs e)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            var targetNamesCount = new SortedDictionary <string, int>();
            var selectedProjects = new List <EnvDTE.Project>();

            //Ignore standard targets as we dont want to display a huge target list
            var winDrive      = Path.GetPathRoot(Environment.GetFolderPath(Environment.SpecialFolder.Windows));
            var winDir        = Environment.GetFolderPath(Environment.SpecialFolder.Windows);
            var ignoreFolders = new[] {
                Path.Combine(winDir, "Microsoft.NET"),
                Path.Combine(winDrive, "Program Files (x86)"),
                Path.Combine(winDrive, "Program Files")
            };

            var projCount = _dte.SelectedItems.Count;

            for (var k = 1; k <= projCount; k++) //Iterate through all selected items
            {
                var selectedProject = _dte.SelectedItems.Item(k).Project;
                selectedProjects.Add(selectedProject); //Add to selectedProjects

                var evalProject = ProjectCollection.GlobalProjectCollection.LoadProject(selectedProject.FullName);
                var execProject = evalProject.CreateProjectInstance();

                foreach (var target in execProject.Targets)
                {
                    var targetName     = $"{target.Value.Name}";
                    var targetFilePath = Path.GetDirectoryName(target.Value.FullPath);

                    if (ignoreFolders.Any(t => Helpers.IsPathSubpathOf(t, targetFilePath)))
                    {
                        continue; // Ignore
                    }
                    if (targetNamesCount.ContainsKey(targetName))
                    {
                        targetNamesCount[targetName]++;
                    }
                    else
                    {
                        targetNamesCount[targetName] = 1;
                    }
                }
            }

            var commonTargets = targetNamesCount.Where(t => t.Value == projCount).Select(t => t.Key);

            var selectTargetsWindow = new SelectTargetsWindow {
                DataContext = this
            };

            foreach (var item in commonTargets)
            {
                selectTargetsWindow.ItemsComboBox.Items.Add(item);
            }
            selectTargetsWindow.ItemsComboBox.SelectedIndex = 0;

            if (selectTargetsWindow.ShowDialog() == true)
            {
                var targetName = (string)selectTargetsWindow.ItemsComboBox.SelectedItem;

                ExecuteTarget(selectedProjects, targetName);
            }
        }