public PackageDescription GetDescription(LockFilePackageLibrary package, LockFileTargetLibrary targetLibrary) { // If a NuGet dependency is supposed to provide assemblies but there is no assembly compatible with // current target framework, we should mark this dependency as unresolved var containsAssembly = package.Files .Any(x => x.StartsWith($"ref{Path.DirectorySeparatorChar}") || x.StartsWith($"lib{Path.DirectorySeparatorChar}")); var compatible = targetLibrary.FrameworkAssemblies.Any() || targetLibrary.CompileTimeAssemblies.Any() || targetLibrary.RuntimeAssemblies.Any() || !containsAssembly; var dependencies = new List<LibraryRange>(targetLibrary.Dependencies.Count + targetLibrary.FrameworkAssemblies.Count); PopulateDependencies(dependencies, targetLibrary); var path = _packagePathResolver.GetInstallPath(package.Name, package.Version); var packageDescription = new PackageDescription( path, package, targetLibrary, dependencies, compatible); return packageDescription; }
public PackageDescription( string path, LockFilePackageLibrary package, LockFileTargetLibrary lockFileLibrary, IEnumerable<LibraryRange> dependencies, bool compatible) : base(new LibraryIdentity(package.Name, package.Version, LibraryType.Package), "sha512-" + package.Sha512, path, dependencies: dependencies, framework: null, resolved: compatible, compatible: compatible) { Library = package; Target = lockFileLibrary; }