Ejemplo n.º 1
0
        private static IList <string> GetFrameworkProfiles(string frameworkReferenceRoot, string frameworkIdentifier, string frameworkVersion)
        {
            if (string.IsNullOrEmpty(frameworkReferenceRoot))
            {
                throw new ArgumentException("Invalid frameworkReferenceRoot", "frameworkReferenceRoot");
            }
            if (string.IsNullOrEmpty(frameworkIdentifier))
            {
                throw new ArgumentException("Invalid frameworkIdentifier", "frameworkIdentifier");
            }
            if (string.IsNullOrEmpty(frameworkVersion))
            {
                throw new ArgumentException("Invalid frameworkVersion", "frameworkVersion");
            }
            List <string> list = new List <string>();
            DirectoryInfo info = new DirectoryInfo(Path.Combine(Path.Combine(Path.Combine(frameworkReferenceRoot, frameworkIdentifier), frameworkVersion), "Profiles"));

            if (info.Exists)
            {
                foreach (DirectoryInfo info2 in info.GetDirectories())
                {
                    Version        version = VersionUtilities.ConvertToVersion(frameworkVersion);
                    IList <string> pathToReferenceAssemblies = GetPathToReferenceAssemblies(new FrameworkName(frameworkIdentifier, version, info2.Name));
                    if ((pathToReferenceAssemblies != null) && (pathToReferenceAssemblies.Count > 0))
                    {
                        list.Add(info2.Name);
                    }
                }
            }
            return(list);
        }
Ejemplo n.º 2
0
 public static IList <string> GetSupportedTargetFrameworks()
 {
     lock (locker)
     {
         if (targetFrameworkMonikers == null)
         {
             targetFrameworkMonikers = new List <string>();
             foreach (string str in GetFrameworkIdentifiers(FrameworkLocationHelper.programFilesReferenceAssemblyLocation))
             {
                 foreach (string str2 in GetFrameworkVersions(FrameworkLocationHelper.programFilesReferenceAssemblyLocation, str))
                 {
                     Version version = VersionUtilities.ConvertToVersion(str2);
                     targetFrameworkMonikers.Add(new FrameworkName(str, version, null).FullName);
                     foreach (string str3 in GetFrameworkProfiles(FrameworkLocationHelper.programFilesReferenceAssemblyLocation, str, str2))
                     {
                         targetFrameworkMonikers.Add(new FrameworkName(str, version, str3).FullName);
                     }
                 }
             }
         }
     }
     return(targetFrameworkMonikers);
 }