当前位置: 首页>>代码示例>>C#>>正文


C# IPackage.GetCompatiblePackageDependencies方法代码示例

本文整理汇总了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());
            }
        }
开发者ID:shrknt35,项目名称:sonarlint-vs,代码行数:34,代码来源:DefaultManifestValuesRule.cs

示例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 });
            }
        }
开发者ID:jden,项目名称:scriptcs,代码行数:14,代码来源:PackageObject.cs

示例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;
            }
        }
开发者ID:Newtopian,项目名称:nuget,代码行数:49,代码来源:DefaultManifestValuesRule.cs

示例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;
        }
开发者ID:patricksadowski,项目名称:NuGet.Dgml,代码行数:15,代码来源:UpgradeWalker.cs

示例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 });
            }
        }
开发者ID:mcdudr01,项目名称:CECS550CShell,代码行数:17,代码来源:PackageObject.cs

示例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);
        }
开发者ID:sistoimenov,项目名称:NuGet2,代码行数:87,代码来源:PackageWalker.cs

示例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)));
 }
开发者ID:Newtopian,项目名称:nuget,代码行数:5,代码来源:InMemoryPackageManager.cs

示例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);
                    }
                }
            }
        }
开发者ID:AtwooTM,项目名称:sonarqube-roslyn-sdk,代码行数:29,代码来源:NuGetPackageHandler.cs


注:本文中的IPackage.GetCompatiblePackageDependencies方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。