Exemplo n.º 1
0
        public DestFolder(string destinationFolder, IDefaultNuGetFramework defaultFramework)
        {
#if NETCORE
            var targetFramework = defaultFramework.GetHighest().FirstOrDefault();
            Framework          = targetFramework.DotNetFrameworkName;
            SupportedPlatforms = ImmutableList.Create(FrameworkParser.ToSpecificPlatform(targetFramework));
#else
            Framework = defaultFramework.GetLowest().FirstOrDefault()?.ToString();
#endif
            Log.Info($"Current target framework for plugins set as '{Framework}'");

            // Note: commented part for testing correct package resolving to 4.X versions
            //var tfm472 = (defaultFramework as DefaultNuGetFramework).GetFirst();
            //Framework = tfm472.ToString();
            // SupportedPlatforms = ImmutableList.Create(FrameworkParser.ToSpecificPlatform(tfm472));

            // Default initialization
            if (SupportedPlatforms is null)
            {
                SupportedPlatforms = ImmutableList.Create <NuGetFramework>();
            }

            ContentPath   = destinationFolder;
            _pathResolver = new PackagePathResolver(destinationFolder);
        }
Exemplo n.º 2
0
        private async Task ResolvePackageReferenceDependencyAsync(PackageReference packageReference, List <PackageReference> gatheredReferences, bool useStableVersions)
        {
            var chosenFramework = _defaultNuGetFramework.GetLowest().LastOrDefault();

            var result = await _packageDependencyResolverService.ResolveAsync(packageReference.From, chosenFramework, useStableVersions);

            //transform to distinct list of package references
            var transformedCollection = result.SelectMany(package => (package as SourcePackageDependencyInfo)?.ToSeparateReferences()).Distinct().ToList();

            gatheredReferences.AddRange(transformedCollection);
        }