本文整理汇总了C#中NuGet.PackageDependency类的典型用法代码示例。如果您正苦于以下问题:C# PackageDependency类的具体用法?C# PackageDependency怎么用?C# PackageDependency使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PackageDependency类属于NuGet命名空间,在下文中一共展示了PackageDependency类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DetectUpgradeAction
private static PackageUpgradeAction DetectUpgradeAction(PackageDependency dependency, IPackage recentPackage)
{
var upgradeType = PackageUpgradeAction.None;
if (recentPackage == null)
{
upgradeType = PackageUpgradeAction.Unknown;
}
else if (dependency.VersionSpec.Satisfies(recentPackage.Version))
{
upgradeType = IsMinVersionUpgradeable(dependency, recentPackage)
? PackageUpgradeAction.MinVersion
: PackageUpgradeAction.None;
}
else
{
var fromRelease = DependsOnReleaseVersion(dependency);
if (recentPackage.IsReleaseVersion())
{
upgradeType = fromRelease ? PackageUpgradeAction.ReleaseToRelease : PackageUpgradeAction.PrereleaseToRelease;
}
else
{
upgradeType = fromRelease ? PackageUpgradeAction.ReleaseToPrerelease : PackageUpgradeAction.PrereleaseToPrerelease;
}
}
return upgradeType;
}
示例2: GetLinkTo_dependency_should_return_link_with_dependency_name_as_target
public void GetLinkTo_dependency_should_return_link_with_dependency_name_as_target()
{
var p = new TestPackage { Id = "test-package", Version = new Version("1.2.3") };
var dependency = new PackageDependency("dep", new VersionSpec { MinVersion = new Version("1.2.3") });
Assert.AreEqual("dep (1.2.3)", p.GetLinkTo(dependency).Target);
}
示例3: GetLinkTo_dependency_should_return_link_with_packge_category
public void GetLinkTo_dependency_should_return_link_with_packge_category()
{
var p = new TestPackage { Id = "test-package", Version = new Version("1.2.3") };
var dependency = new PackageDependency("dep", new VersionSpec { MinVersion = new Version("1.2.3") });
Assert.AreEqual("Package", p.GetLinkTo(dependency).Category1);
}
示例4: IsPrereleaseDependency
private static bool IsPrereleaseDependency(PackageDependency pd)
{
if (pd.VersionSpec == null)
{
return false;
}
return IsPreReleasedVersion(pd.VersionSpec.MinVersion) || IsPreReleasedVersion(pd.VersionSpec.MaxVersion);
}
示例5: CreatePackageIssue
private static PackageIssue CreatePackageIssue(PackageDependency target)
{
return new PackageIssue(
PackageIssueLevel.Error,
"Invalid prerelease dependency",
String.Format(CultureInfo.CurrentCulture,
"A stable release of a package must not have a dependency on a prerelease package, '{0}'.",
target),
String.Format(CultureInfo.CurrentCulture,
"Either modify the version spec of dependency '{0}' or update the version field.", target)
);
}
示例6: ShowDownloadStatus
public void ShowDownloadStatus(PackageDependency dependentPackage)
{
if (uxDownloadStatus.InvokeRequired)
{
uxDownloadStatus.Invoke((Action)(() =>
{
uxDownloadStatus.Text = "Downloading the dependencies\n" + "Downloading " + dependentPackage.Id;
}));
}
else
{
uxDownloadStatus.Text = "Downloading the dependencies\n" + "Downloading " + dependentPackage.Id;
}
}
示例7: Map
public Dependency Map(PackageDependency packageDependency, string packageId, string packageVersion)
{
if (packageDependency == null)
{
throw new ArgumentNullException("packageDependency");
}
string versionSpec = packageDependency.VersionSpec != null ? packageDependency.VersionSpec.ToString() : string.Empty;
return new Dependency
{
Name = packageDependency.Id,
PackageId = !string.IsNullOrWhiteSpace(packageId) ? packageId : string.Empty,
PackageVersion = !string.IsNullOrWhiteSpace(packageVersion) ? packageVersion : string.Empty,
VersionSpec = versionSpec
};
}
示例8: ResolveDependency
public IPackage ResolveDependency(PackageDependency dependency, IPackageConstraintProvider constraintProvider, bool allowPrereleaseVersions, bool preferListedPackages, DependencyVersion dependencyVersion)
{
IDependencyResolver dependencyResolver = _repo as IDependencyResolver;
if (dependencyResolver != null)
{
return dependencyResolver.ResolveDependency(dependency, constraintProvider, allowPrereleaseVersions, preferListedPackages, dependencyVersion);
}
return DependencyResolveUtility.ResolveDependencyCore(
_repo,
dependency,
constraintProvider,
allowPrereleaseVersions,
preferListedPackages,
dependencyVersion);
}
示例9: AddInDependency
public AddInDependency(PackageDependency packageDependency)
{
if (packageDependency != null)
{
IVersionSpec versionSpec = packageDependency.VersionSpec;
Id = packageDependency.Id;
if (versionSpec.MinVersion != null)
{
MinimumVersion = versionSpec.MinVersion.Version;
}
if (versionSpec.MaxVersion != null)
{
MaximumVersion = versionSpec.MaxVersion.Version;
}
IncludeMinimumVersion = packageDependency.VersionSpec.IsMinInclusive;
IncludeMaximumVersion = packageDependency.VersionSpec.IsMaxInclusive;
}
}
示例10: Context
public override void Context()
{
var minVersionSpec = new VersionSpec
{
MinVersion = new SemanticVersion("1.0.0"),
IsMinInclusive = true
};
packageDependencyWithMinVersion = new PackageDependency("fiddler", minVersionSpec);
var minAndMaxVersionSpec = new VersionSpec
{
MinVersion = new SemanticVersion("1.0.0"),
MaxVersion = new SemanticVersion("2.0.0"),
IsMinInclusive = true
};
packageDependencyWithMaxVersion = new PackageDependency("dude", minAndMaxVersionSpec);
guideline = new DependencyWithNoVersionGuideline();
}
示例11: OnDependencyResolveError
protected virtual void OnDependencyResolveError(PackageDependency dependency)
{
}
示例12: DependsOnReleaseVersion
private static bool DependsOnReleaseVersion(PackageDependency dependency)
{
return (dependency.VersionSpec.MaxVersion != null) &&
string.IsNullOrEmpty(dependency.VersionSpec.MaxVersion.SpecialVersion) &&
dependency.VersionSpec.IsMaxInclusive;
}
示例13: IsMinVersionUpgradeable
private static bool IsMinVersionUpgradeable(PackageDependency dependency, IPackage recentPackage)
{
return (dependency.VersionSpec.MinVersion != null) && (dependency.VersionSpec.MinVersion < recentPackage.Version);
}
示例14: ResolveDependency
protected override IPackage ResolveDependency(PackageDependency dependency)
{
return Repository.FindDependency(dependency);
}
示例15: ResolveDependency
public IPackage ResolveDependency(PackageDependency dependency, IPackageConstraintProvider constraintProvider, bool allowPrereleaseVersions, bool preferListedPackages, DependencyVersion dependencyVersion)
{
// Use the primary repository to look up dependencies. Fallback to the aggregate repository only if we can't find a package here.
return _primaryRepository.ResolveDependency (dependency, constraintProvider, allowPrereleaseVersions, preferListedPackages, dependencyVersion) ??
_dependencyResolver.ResolveDependency (dependency, constraintProvider, allowPrereleaseVersions, preferListedPackages, dependencyVersion);
}