private void ShowWarningsForPackageReinstallation(Solution solution)
        {
            Debug.Assert(solution != null);

            foreach (Project project in solution.Projects)
            {
                var nuGetProject = EnvDTEProjectUtility.GetNuGetProject(project, _solutionManager);
                if (ProjectRetargetingUtility.IsProjectRetargetable(nuGetProject))
                {
                    var packageReferencesToBeReinstalled = ProjectRetargetingUtility.GetPackageReferencesMarkedForReinstallation(nuGetProject);
                    if (packageReferencesToBeReinstalled.Count > 0)
                    {
                        Debug.Assert(ProjectRetargetingUtility.IsNuGetInUse(project));
                        var projectHierarchy = VsHierarchyUtility.ToVsHierarchy(project);
                        ShowRetargetingErrorTask(packageReferencesToBeReinstalled.Select(p => p.PackageIdentity.Id), projectHierarchy, TaskErrorCategory.Warning, TaskPriority.Normal);
                    }
                }
            }
        }
Пример #2
0
        private async System.Threading.Tasks.Task ShowWarningsForPackageReinstallationAsync(Solution solution)
        {
            Debug.Assert(solution != null);

            await NuGetUIThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            foreach (Project project in solution.Projects)
            {
                var nuGetProject = await EnvDTEProjectUtility.GetNuGetProjectAsync(project, _solutionManager);

                if (ProjectRetargetingUtility.IsProjectRetargetable(nuGetProject))
                {
                    var packageReferencesToBeReinstalled = ProjectRetargetingUtility.GetPackageReferencesMarkedForReinstallation(nuGetProject);
                    if (packageReferencesToBeReinstalled.Count > 0)
                    {
                        Debug.Assert(await ProjectRetargetingUtility.IsNuGetInUseAsync(project));
                        var projectHierarchy = await project.ToVsHierarchyAsync();

                        ShowRetargetingErrorTask(packageReferencesToBeReinstalled.Select(p => p.PackageIdentity.Id), projectHierarchy, TaskErrorCategory.Warning, TaskPriority.Normal);
                    }
                }
            }
        }