public async Task <LocalPackage> DownloadPackage( CancellationToken ct, PackageIdentity packageIdentity, string downloadLocation ) { var version = await _packageSource.GetPackageVersion(ct, packageIdentity); if (version == null) //Package with this version doesn't exist in the source, skipping. { return(null); } var downloadResult = await _packageSource.DownloadPackage(ct, packageIdentity, downloadLocation, Logger); var localPackagePath = Path.Combine(downloadLocation, $"{packageIdentity}.nupkg"); File.WriteAllBytes(localPackagePath, downloadResult.PackageStream.ReadBytes()); return(new LocalPackage(packageIdentity, localPackagePath)); }