public bool TryResolveAssemblyPaths([NotNull] CompilationLibrary library, [NotNull][ItemNotNull] List <string> assemblies) { if (_nugetPackageDirectories.Count == 0 || !string.Equals(library.Type, "package", StringComparison.OrdinalIgnoreCase)) { return(false); } foreach (var directory in _nugetPackageDirectories) { if (!ResolverUtils.TryResolvePackagePath(FileSystem, library, directory, out var packagePath)) { continue; } if (!TryResolveFromPackagePath(library, packagePath, out var fullPathsFromPackage)) { continue; } assemblies.AddRange(fullPathsFromPackage); return(true); } return(false); }
private static bool TryResolveFromPackagePath([NotNull] CompilationLibrary library, [NotNull] string basePath, [CanBeNull][ItemNotNull] out IEnumerable <string> results) { var paths = new List <string>(); foreach (var assembly in library.Assemblies) { if (!ResolverUtils.TryResolveAssemblyFile(FileSystem, basePath, assembly, out var fullName)) { // if one of the files can't be found, skip this package path completely. // there are package paths that don't include all of the "ref" assemblies // (ex. ones created by 'dotnet store') results = null; return(false); } paths.Add(fullName); } results = paths; return(true); }