public bool IsCompatibleWith(FrameworkName framework) { if (framework == null) { throw new ArgumentNullException("framework"); } return(SupportedFrameworks.Any(f => VersionUtility.IsCompatible(framework, f))); }
public bool IsCompatibleWith(FrameworkName projectFramework, NetPortableProfileTable portableProfileTable) { if (projectFramework == null) { throw new ArgumentNullException("projectFramework"); } return(SupportedFrameworks.Any(packageFramework => VersionUtility.IsCompatible(projectFramework, packageFramework, portableProfileTable)) || portableProfileTable.HasCompatibleProfileWith(this, projectFramework, portableProfileTable)); }
public bool IsCompatibleWith(NetPortableProfile other) { if (other == null) { throw new ArgumentNullException("other"); } return(other.SupportedFrameworks.All( projectFramework => this.SupportedFrameworks.Any( packageFramework => VersionUtility.IsCompatible(projectFramework, packageFramework)))); }
public bool IsCompatibleWith(NetPortableProfile projectFrameworkProfile, NetPortableProfileTable portableProfileTable) { if (projectFrameworkProfile == null) { throw new ArgumentNullException("projectFrameworkProfile"); } return(projectFrameworkProfile.SupportedFrameworks.All( projectFramework => this.SupportedFrameworks.Any( packageFramework => VersionUtility.IsCompatible(projectFramework, packageFramework, portableProfileTable)))); }
private void AddPackageReferenceToNuGetAwareProject(IPackage package) { INuGetPackageManager project = this.Project as INuGetPackageManager; Dictionary <string, object> options = new Dictionary <string, object>(); using (CancellationTokenSource source = new CancellationTokenSource()) { IEnumerable <FrameworkName> packageSupportedFrameworks = package.GetSupportedFrameworks(); IReadOnlyCollection <FrameworkName> result = project.GetSupportedFrameworksAsync(source.Token).Result; options["Frameworks"] = (from projectFramework in result where VersionUtility.IsCompatible(projectFramework, packageSupportedFrameworks) select projectFramework).ToArray <FrameworkName>(); NuGetPackageMoniker moniker1 = new NuGetPackageMoniker(); moniker1.Id = package.Id; moniker1.Version = package.Version.ToString(); project.InstallPackageAsync(moniker1, options, null, null, source.Token).Wait(); } }
private static Version GetEffectiveFrameworkVersion(FrameworkName projectFramework, FrameworkName targetFrameworkVersion) { if (targetFrameworkVersion.IsPortableFramework()) { NetPortableProfile profile = NetPortableProfile.Parse(targetFrameworkVersion.Profile); if (profile != null) { // if it's a portable library, return the version of the matching framework var compatibleFramework = profile.SupportedFrameworks.FirstOrDefault(f => VersionUtility.IsCompatible(projectFramework, f)); if (compatibleFramework != null) { return(compatibleFramework.Version); } } } return(targetFrameworkVersion.Version); }
private static bool SupportsTargetFrameworks(IEnumerable <FrameworkName> targetFramework, IPackage package) { return(targetFramework.IsEmpty() || targetFramework.Any(t => VersionUtility.IsCompatible(t, package.GetSupportedFrameworks()))); }
internal static int GetCompatibilityBetweenPortableLibraryAndNonPortableLibrary(FrameworkName frameworkName, FrameworkName portableFramework) { NetPortableProfile profile = NetPortableProfile.Parse(portableFramework.Profile); if (profile == null) { // defensive coding, this should never happen Debug.Fail("'portableFramework' is not a valid portable framework."); return(0); } // among the supported frameworks by the Portable library, pick the one that is compatible with 'frameworkName' var compatibleFramework = profile.SupportedFrameworks.FirstOrDefault(f => VersionUtility.IsCompatible(frameworkName, f)); return(compatibleFramework == null ? 0 : GetProfileCompatibility(frameworkName, compatibleFramework)); }
public bool IsCompatibleWith(NetPortableProfile projectFrameworkProfile, NetPortableProfileTable portableProfileTable) { if (projectFrameworkProfile == null) { throw new ArgumentNullException("projectFrameworkProfile"); } return(Enumerable.All <FrameworkName>(projectFrameworkProfile.SupportedFrameworks, (Func <FrameworkName, bool>)(projectFramework => Enumerable.Any <FrameworkName>(this.SupportedFrameworks, (Func <FrameworkName, bool>)(packageFramework => VersionUtility.IsCompatible(projectFramework, packageFramework, portableProfileTable)))))); }