本文整理汇总了C#中IPackage.GetCompatiblePackageDependencies方法的典型用法代码示例。如果您正苦于以下问题:C# IPackage.GetCompatiblePackageDependencies方法的具体用法?C# IPackage.GetCompatiblePackageDependencies怎么用?C# IPackage.GetCompatiblePackageDependencies使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPackage
的用法示例。
在下文中一共展示了IPackage.GetCompatiblePackageDependencies方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Validate
public IEnumerable<PackageIssue> Validate(IPackage package)
{
if (package.ProjectUrl != null && package.ProjectUrl.OriginalString.Equals(SpecCommand.SampleProjectUrl, StringComparison.Ordinal))
{
yield return CreateIssueFor("ProjectUrl", package.ProjectUrl.OriginalString);
}
if (package.LicenseUrl != null && package.LicenseUrl.OriginalString.Equals(SpecCommand.SampleLicenseUrl, StringComparison.Ordinal))
{
yield return CreateIssueFor("LicenseUrl", package.LicenseUrl.OriginalString);
}
if (package.IconUrl != null && package.IconUrl.OriginalString.Equals(SpecCommand.SampleIconUrl, StringComparison.Ordinal))
{
yield return CreateIssueFor("IconUrl", package.IconUrl.OriginalString);
}
if (!String.IsNullOrEmpty(package.Tags) && package.Tags.Trim().Equals(SpecCommand.SampleTags, StringComparison.Ordinal))
{
yield return CreateIssueFor("Tags", SpecCommand.SampleTags);
}
if (SpecCommand.SampleReleaseNotes.Equals(package.ReleaseNotes, StringComparison.Ordinal))
{
yield return CreateIssueFor("ReleaseNotes", SpecCommand.SampleReleaseNotes);
}
if (SpecCommand.SampleDescription.Equals(package.Description, StringComparison.Ordinal))
{
yield return CreateIssueFor("Description", SpecCommand.SampleDescription);
}
var dependency = package.GetCompatiblePackageDependencies(targetFramework: null).FirstOrDefault();
if (dependency != null && dependency.Id.Equals(SpecCommand.SampleManifestDependency.Id, StringComparison.Ordinal)
&& dependency.VersionSpec.ToString().Equals("[" + SpecCommand.SampleManifestDependency.Version + "]", StringComparison.Ordinal))
{
yield return CreateIssueFor("Dependency", dependency.ToString());
}
}
示例2: PackageObject
public PackageObject(IPackage package, FrameworkName frameworkName)
{
_package = package;
FrameworkName = frameworkName;
Id = package.Id;
Version = package.Version.Version;
TextVersion = package.Version.ToString();
var dependencies = _package.GetCompatiblePackageDependencies(frameworkName);
if (dependencies != null)
{
Dependencies = dependencies.Select(i => new PackageObject(i.Id) { FrameworkName = frameworkName });
}
}
示例3: Validate
public IEnumerable<PackageIssue> Validate(IPackage package)
{
if (package.ProjectUrl != null && package.ProjectUrl.OriginalString.Equals(SpecCommand.SampleProjectUrl, StringComparison.Ordinal))
{
yield return CreateIssueFor("ProjectUrl", package.ProjectUrl.OriginalString);
}
if (package.LicenseUrl != null && package.LicenseUrl.OriginalString.Equals(SpecCommand.SampleLicenseUrl, StringComparison.Ordinal))
{
yield return CreateIssueFor("LicenseUrl", package.LicenseUrl.OriginalString);
}
if (package.IconUrl != null && package.IconUrl.OriginalString.Equals(SpecCommand.SampleIconUrl, StringComparison.Ordinal))
{
yield return CreateIssueFor("IconUrl", package.IconUrl.OriginalString);
}
if (!String.IsNullOrEmpty(package.Tags) && package.Tags.Trim().Equals(SpecCommand.SampleTags, StringComparison.Ordinal))
{
yield return CreateIssueFor("Tags", SpecCommand.SampleTags);
}
if (SpecCommand.SampleReleaseNotes.Equals(package.ReleaseNotes, StringComparison.Ordinal))
{
yield return CreateIssueFor("ReleaseNotes", SpecCommand.SampleReleaseNotes);
}
if (SpecCommand.SampleDescription.Equals(package.Description, StringComparison.Ordinal))
{
yield return CreateIssueFor("Description", SpecCommand.SampleDescription);
}
var dependency = package.GetCompatiblePackageDependencies(targetFramework: null).FirstOrDefault();
if (dependency != null &&
dependency.Id.Equals(SpecCommand.SampleManifestDependency.Id, StringComparison.Ordinal) &&
dependency.VersionSpec != null &&
dependency.VersionSpec.ToString().Equals("[" + SpecCommand.SampleManifestDependency.Version + "]", StringComparison.Ordinal))
{
yield return CreateIssueFor("Dependency", dependency.ToString());
}
if (dependency != null && dependency.VersionSpec == null)
{
var message = String.Format(
CultureInfo.CurrentCulture,
LocalizedResourceManager.GetString("Warning_UnspecifiedDependencyVersion"),
dependency.Id);
var issue = new PackageIssue(
LocalizedResourceManager.GetString("Warning_UnspecifiedDependencyVersionTitle"),
message,
LocalizedResourceManager.GetString("Warning_UnspecifiedDependencyVersionSolution"));
yield return issue;
}
}
示例4: IdentifyUpgrades
private IEnumerable<PackageUpgrade> IdentifyUpgrades(IPackage package)
{
IList<PackageUpgrade> upgrades = new List<PackageUpgrade>();
foreach (var dependency in package.GetCompatiblePackageDependencies(_targetFramework))
{
var recentDependencyPackage = _packageRepository.FindPackage(dependency.Id);
var upgradeType = DetectUpgradeAction(dependency, recentDependencyPackage);
upgrades.Add(new PackageUpgrade(dependency, upgradeType, recentDependencyPackage));
}
return upgrades;
}
示例5: PackageObject
public PackageObject(IPackage package, FrameworkName frameworkName)
{
_package = package;
FrameworkName = frameworkName;
Id = package.Id;
Version = package.Version.Version;
TextVersion = package.Version.ToString();
FrameworkAssemblies = package.FrameworkAssemblies
.Where(x => x.SupportedFrameworks.Any(y => y == frameworkName))
.Select(x => x.AssemblyName);
var dependencies = _package.GetCompatiblePackageDependencies(frameworkName);
if (dependencies != null)
{
Dependencies = dependencies.Select(i => new PackageObject(i.Id) { FrameworkName = frameworkName });
}
}
示例6: Walk
public void Walk(IPackage package)
{
CheckPackageMinClientVersion(package);
// Do nothing if we saw this package already
if (Marker.IsVisited(package))
{
ProcessPackageTarget(package);
return;
}
OnBeforePackageWalk(package);
// Mark the package as processing
Marker.MarkProcessing(package);
if (!IgnoreDependencies)
{
foreach (var dependency in package.GetCompatiblePackageDependencies(TargetFramework))
{
// Try to resolve the dependency from the visited packages first
IPackage resolvedDependency = DependencyResolveUtility.ResolveDependency(
Marker,
dependency, constraintProvider: null,
allowPrereleaseVersions: AllowPrereleaseVersions,
preferListedPackages: false,
dependencyVersion: DependencyVersion);
if (resolvedDependency == null)
{
resolvedDependency = ResolveDependency(dependency);
}
if (resolvedDependency == null)
{
OnDependencyResolveError(dependency);
// If we're skipping dependency resolve errors then move on to the next
// dependency
if (SkipDependencyResolveError)
{
continue;
}
return;
}
if (!IgnoreWalkInfo)
{
// Set the parent
PackageWalkInfo dependencyInfo = GetPackageInfo(resolvedDependency);
dependencyInfo.Parent = package;
}
Marker.AddDependent(package, resolvedDependency);
if (!OnAfterResolveDependency(package, resolvedDependency))
{
continue;
}
if (Marker.IsCycle(resolvedDependency) ||
Marker.IsVersionCycle(resolvedDependency.Id))
{
if (RaiseErrorOnCycle)
{
List<IPackage> packages = Marker.Packages.ToList();
packages.Add(resolvedDependency);
throw new InvalidOperationException(
String.Format(CultureInfo.CurrentCulture,
NuGetResources.CircularDependencyDetected, String.Join(" => ",
packages.Select(p => p.GetFullName()))));
}
continue;
}
Walk(resolvedDependency);
}
}
// Mark the package as visited
Marker.MarkVisited(package);
ProcessPackageTarget(package);
OnAfterPackageWalk(package);
}
示例7: FindDependenciesToBeInstalled
public IEnumerable<IPackage> FindDependenciesToBeInstalled(IPackage package)
{
var dependencies = package.GetCompatiblePackageDependencies(null);
return dependencies.SelectMany(dependency => this.RemotePackages.Where(remote => remote.Id == dependency.Id && dependency.VersionSpec.Satisfies(remote.Version)));
}
示例8: GetAllDependencies
private void GetAllDependencies(IPackage current, List<IPackage> collectedDependencies)
{
this.logger.LogDebug(UIResources.NG_ResolvingPackageDependencies, current.Id, current.Version);
Debug.Assert(current != null);
foreach (PackageDependency dependency in current.GetCompatiblePackageDependencies(null))
{
IPackage dependencyPackage = this.packageManager.LocalRepository.ResolveDependency(dependency, true, true);
if (dependencyPackage == null)
{
this.logger.LogWarning(UIResources.NG_FailedToResolveDependency, dependency.Id, dependency.VersionSpec.ToString());
}
else
{
if (collectedDependencies.Contains(dependencyPackage))
{
this.logger.LogDebug(UIResources.NG_DuplicateDependency, dependencyPackage.Id, dependencyPackage.Version);
}
else
{
this.logger.LogDebug(UIResources.NG_AddingNewDependency, dependencyPackage.Id, dependencyPackage.Version);
collectedDependencies.Add(dependencyPackage);
GetAllDependencies(dependencyPackage, collectedDependencies);
}
}
}
}