/// <summary>
        /// Gets the list of packages to be reinstalled based on the Project instance and the localRepository to find packages in
        /// </summary>
        /// <param name="project">Project for which packages to be reinstalled are determined</param>
        /// <param name="localRepository">Local Repository from which packages listed in project's packages.config are loaded</param>
        /// <returns></returns>
        internal static IList <IPackage> GetPackagesToBeReinstalled(Project project, IPackageRepository localRepository)
        {
            Debug.Assert(project != null);

            // First call to VsUtility.PackageConfigExists(project) checks if there is a packages.config file under the project folder, Otherwise, return emtpy list
            // If present, then call VsUtility.IsNuGetInUse to see if NuGet is used in the project. The second call might result in loading of NuGet.VisualStudio.dll
            if (localRepository != null && VsUtility.PackagesConfigExists(project) && project.IsNuGetInUse())
            {
                return(GetPackagesToBeReinstalled(project.GetTargetFrameworkName(), GetPackageReferences(project), localRepository));
            }

            return(new List <IPackage>());
        }
        /// <summary>
        /// Returns a list of package references that were marked for reinstallation in packages.config of the project
        /// </summary>
        internal static IList <PackageReference> GetPackageReferencesMarkedForReinstallation(Project project)
        {
            Debug.Assert(project != null);

            // First call to VsUtility.PackageConfigExists(project) checks if there is a packages.config file under the project folder, Otherwise, return emtpy list
            // If present, then call VsUtility.IsNuGetInUse to see if NuGet is used in the project. The second call might result in loading of NuGet.VisualStudio.dll
            if (VsUtility.PackagesConfigExists(project) && project.IsNuGetInUse())
            {
                PackageReferenceFile packageReferenceFile = GetPackageReferenceFile(project);
                Debug.Assert(packageReferenceFile != null);

                IEnumerable <PackageReference> packageReferences = packageReferenceFile.GetPackageReferences();
                return(packageReferences.Where(p => p.RequireReinstallation).ToList());
            }

            return(new List <PackageReference>());
        }