Example #1
0
 private static void AppendFrameworkProperties(IncrementalHasher hasher, IVsTargetFrameworkInfo2 framework)
 {
     foreach (IVsProjectProperty property in framework.Properties)
     {
         AppendProperty(hasher, property.Name, property.Value);
     }
 }
Example #2
0
        private static void LogTargetFramework(BatchLogger logger, IVsTargetFrameworkInfo2 targetFrameworkInfo)
        {
            logger.WriteLine(targetFrameworkInfo.TargetFrameworkMoniker);
            logger.IndentLevel++;

            LogReferenceItems(logger, "Framework References", targetFrameworkInfo.FrameworkReferences);
            LogReferenceItems(logger, "Package Downloads", targetFrameworkInfo.PackageDownloads);
            LogReferenceItems(logger, "Project References", targetFrameworkInfo.ProjectReferences);
            LogReferenceItems(logger, "Package References", targetFrameworkInfo.PackageReferences);
            LogProperties(logger, "Target Framework Properties", targetFrameworkInfo.Properties);

            logger.IndentLevel--;
        }
        private IVsTargetFrameworks2 GetAllTargetFrameworks(IEnumerable <ProjectRestoreUpdate> updates)
        {
            var frameworks = new List <IVsTargetFrameworkInfo2>();

            foreach (ProjectRestoreUpdate update in updates)
            {
                Assumes.True(update.RestoreInfo.TargetFrameworks.Count == 1);

                IVsTargetFrameworkInfo2 framework = update.RestoreInfo.TargetFrameworks.Item(0);

                if (ValidateTargetFramework(update.ProjectConfiguration, framework))
                {
                    frameworks.Add(framework);
                }
            }

            return(new TargetFrameworks(frameworks));
        }
        private bool ValidateTargetFramework(ProjectConfiguration projectConfiguration, IVsTargetFrameworkInfo2 framework)
        {
            if (framework.TargetFrameworkMoniker.Length == 0)
            {
                ReportDataSourceUserFault(
                    new Exception(string.Format(CultureInfo.CurrentCulture, VSResources.Restore_EmptyTargetFrameworkMoniker, projectConfiguration.Name)),
                    ProjectFaultSeverity.LimitedFunctionality,
                    ContainingProject);

                return(false);
            }

            return(true);
        }
Example #5
0
 private static void PopulateFrameworkDependencies(TargetFrameworkInformation tfi, IVsTargetFrameworkInfo2 targetFrameworkInfo2)
 {
     foreach (var item in targetFrameworkInfo2.FrameworkReferences.Cast <IVsReferenceItem>())
     {
         if (!tfi.FrameworkReferences.Any(e => ComparisonUtility.FrameworkReferenceNameComparer.Equals(e.Name, item.Name)))
         {
             tfi.FrameworkReferences.Add(ToFrameworkDependency(item));
         }
     }
 }