public ResolvedPackageReference( string packageName, string packageVersion, IReadOnlyList <FileInfo> assemblyPaths, DirectoryInfo packageRoot = null, IReadOnlyList <DirectoryInfo> probingPaths = null) : base(packageName, packageVersion) { if (string.IsNullOrWhiteSpace(packageVersion)) { throw new ArgumentException("Value cannot be null or whitespace.", nameof(packageVersion)); } AssemblyPaths = assemblyPaths ?? throw new ArgumentNullException(nameof(assemblyPaths)); ProbingPaths = probingPaths ?? Array.Empty <DirectoryInfo>(); PackageRoot = packageRoot ?? AssemblyPaths.FirstOrDefault()?.Directory.Parent.Parent; }
public ResolvedPackageReference( string packageName, string packageVersion, IReadOnlyList <string> assemblyPaths, string packageRoot = null, IReadOnlyList <string> probingPaths = null) : base(packageName, packageVersion) { if (string.IsNullOrWhiteSpace(packageVersion)) { throw new ArgumentException("Value cannot be null or whitespace.", nameof(packageVersion)); } AssemblyPaths = assemblyPaths ?? throw new ArgumentNullException(nameof(assemblyPaths)); ProbingPaths = probingPaths ?? Array.Empty <string>(); PackageRoot = packageRoot; if (PackageRoot == null && AssemblyPaths.FirstOrDefault() is {} path) { PackageRoot = new FileInfo(path).Directory?.Parent?.Parent?.FullName; } }