int IVsTrackProjectRetargetingEvents.OnRetargetingAfterChange(string projRef, IVsHierarchy pAfterChangeHier, string fromTargetFramework, string toTargetFramework)
        {
            _errorListProvider.Tasks.Clear();
            Project retargetedProject = VsUtility.GetProjectFromHierarchy(pAfterChangeHier);

            if (retargetedProject != null)
            {
                IList <IPackage> packagesToBeReinstalled = ProjectRetargetingUtility.GetPackagesToBeReinstalled(retargetedProject);
                if (!packagesToBeReinstalled.IsEmpty())
                {
                    ShowRetargetingErrorTask(packagesToBeReinstalled.Select(p => p.Id), pAfterChangeHier, TaskErrorCategory.Error, TaskPriority.High);
                }
                ProjectRetargetingUtility.MarkPackagesForReinstallation(retargetedProject, packagesToBeReinstalled);
            }
            return(VSConstants.S_OK);
        }
        int IVsSolutionEventsProjectUpgrade.OnAfterUpgradeProject(IVsHierarchy pHierarchy, uint fUpgradeFlag, string bstrCopyLocation, SYSTEMTIME stUpgradeTime, IVsUpgradeLogger pLogger)
        {
            Debug.Assert(pHierarchy != null);

            Project upgradedProject = VsUtility.GetProjectFromHierarchy(pHierarchy);

            if (upgradedProject != null)
            {
                IList <IPackage> packagesToBeReinstalled = ProjectRetargetingUtility.GetPackagesToBeReinstalled(upgradedProject);

                if (!packagesToBeReinstalled.IsEmpty())
                {
                    pLogger.LogMessage((int)__VSUL_ERRORLEVEL.VSUL_ERROR, upgradedProject.Name, upgradedProject.Name,
                                       String.Format(CultureInfo.CurrentCulture, Resources.ProjectUpgradeAndRetargetErrorMessage, String.Join(", ", packagesToBeReinstalled.Select(p => p.Id))));
                }
            }
            return(VSConstants.S_OK);
        }