Ejemplo n.º 1
0
        /// <summary>
        /// portable-net45+win8 -> net45, win8
        /// </summary>
        private IEnumerable <NuGetFramework> ExplodePortableFramework(NuGetFramework pcl, bool includeOptional = true)
        {
            IEnumerable <NuGetFramework> frameworks = null;

            if (!_mappings.TryGetPortableFrameworks(pcl.Profile, includeOptional, out frameworks))
            {
                Debug.Fail("Unable to get portable frameworks from: " + pcl.ToString());
                frameworks = Enumerable.Empty <NuGetFramework>();
            }

            return(frameworks);
        }
Ejemplo n.º 2
0
 public static string GetTargetGraphName(NuGetFramework framework, string runtimeIdentifier)
 {
     if (string.IsNullOrEmpty(runtimeIdentifier))
     {
         return(framework.ToString());
     }
     else
     {
         return(string.Format(
                    CultureInfo.InvariantCulture,
                    "{0}/{1}",
                    framework,
                    runtimeIdentifier));
     }
 }
Ejemplo n.º 3
0
 public static string GetName(NuGetFramework framework, string runtimeIdentifier)
 {
     if (string.IsNullOrEmpty(runtimeIdentifier))
     {
         return(framework.ToString());
     }
     else
     {
         return(string.Format(
                    CultureInfo.CurrentCulture,
                    "{0} ({1})",
                    framework,
                    runtimeIdentifier));
     }
 }
Ejemplo n.º 4
0
        private static string SynthesizeFrameworkFriendlyName(NuGetFramework targetFramework)
        {
            // Names are not present in the RedistList.xml file for older frameworks or on Mono
            // We do some custom version string rendering to match how net40 is rendered (.NET Framework 4)
            if (targetFramework.Framework.Equals(FrameworkConstants.FrameworkIdentifiers.Net))
            {
                string versionString = targetFramework.Version.Minor == 0 ?
                    targetFramework.Version.Major.ToString() :
                    GetDisplayVersion(targetFramework).ToString();

                string profileString = string.IsNullOrEmpty(targetFramework.Profile) ?
                    string.Empty :
                    $" {targetFramework.Profile} Profile";
                return ".NET Framework " + versionString + profileString;
            }
            return targetFramework.ToString();
        }
Ejemplo n.º 5
0
        private async Task<SourcePackageDependencyInfo> CacheResolvePackage(NuGetFactory factory, PackageIdentity package, NuGetFramework fx)
        {
            string key = String.Format(@"{0}-{1}", package.ToString(), fx.ToString());
            if (base.IsInCache<SourcePackageDependencyInfo>("CacheResolvePackage", key))
            {
                return Get<SourcePackageDependencyInfo>("CacheResolvePackage", key);
            }
            else
            {
                var depResource = await factory.GetDependency();
                var output = await depResource.ResolvePackage(package, fx, CancellationToken.None);
                return Get<SourcePackageDependencyInfo>("CacheResolvePackage", key, () => { return output; });
            }

        }
Ejemplo n.º 6
0
        /// <summary>
        /// portable-net45+win8 -> net45, win8
        /// </summary>
        private IEnumerable<NuGetFramework> ExplodePortableFramework(NuGetFramework pcl, bool includeOptional = true)
        {
            IEnumerable<NuGetFramework> frameworks = null;
            if (!_mappings.TryGetPortableFrameworks(pcl.Profile, includeOptional, out frameworks))
            {
                Debug.Fail("Unable to get portable frameworks from: " + pcl.ToString());
                frameworks = Enumerable.Empty<NuGetFramework>();
            }

            return frameworks;
        }
Ejemplo n.º 7
0
        public string GetFriendlyNuGetFramework(NuGetFramework targetFramework)
        {
            // We don't have a friendly name for this anywhere on the machine so hard code it
            string friendlyName = targetFramework.Framework;
            if (Equals(targetFramework.Framework, FrameworkConstants.CommonFrameworks.DnxCore))
            {
                return "DNX Core " + targetFramework.Version.ToString();
            }
            else if (Equals(targetFramework.Framework, FrameworkConstants.CommonFrameworks.Dnx))
            {
                return "DNX " + targetFramework.Version.ToString();
            }

            var information = _cache.GetOrAdd(targetFramework, GetFrameworkInformation);

            if (information == null)
            {
                return targetFramework.ToString();
            }

            return information.Name;
        }