Given a solution folder, how can we find NuGet packages referenced by each project in this solution with its attributes? In other words, for a given solution path we need a collection of these objects:

public class Package  
    public string Name { get; set; }
    public string Version { get; set; }
    public string TargetFramework { get; set; }

    public string Authors { get; set; }
    public string Description { get; set; }
    public string Summary { get; set; }
    public Uri IconUrl { get; set; }
    public Uri ProjectUrl { get; set; }

It is possible by brute force method which is to simply read packages.config in each project but the remaining attributes are stored in non-text format for each package .nupkg file.

A lot better solution is to use Nuget.Core which is the main engine behind Nuget ecosystem. This is also a project without any documentation and examples and this is what I came up with after digging through Nuget.Core source:

public class ProjectPackagesCollector  
    private static readonly string[] ExcludedPackageNames = { "System", "Microsoft" };

    public static IList<Package> Collect(string projectFolder)
        string packageReferenceFilePath = Path.Combine(projectFolder, "packages.config");
        if (!File.Exists(packageReferenceFilePath))
            return new List<Package>();

        string solutionFolder = Path.GetFullPath(Path.Combine(projectFolder, @"..\"));
        string packageRepositoryPath = Path.Combine(solutionFolder, "packages");

        var packageReferences= new PackageReferenceFile(packageReferenceFilePath);
        var packageRepository = new LocalPackageRepository(packageRepositoryPath);
        var packages = new List<Package>();

        foreach (var packageReference in packageReferences.GetPackageReferences())
            string packageId = packageReference.Id;
            if (ExcludedPackageNames.Any(w => packageId.ToLower().Contains(w.ToLower())))
            var package = new Package
                Name = packageId,
                Version = packageReference.Version.Version.ToString(),
                TargetFramework = packageReference?.TargetFramework?.Version?.ToString()

            // Try to get remaining attributes from local package store
            var nugetPackage = packageRepository.FindPackage(packageId, packageReference.Version);
            if (nugetPackage != null)
                package.Summary = nugetPackage.Summary;
                package.Description = nugetPackage.Description;
                package.Authors = String.Join(",", nugetPackage.Authors);
                package.IconUrl = nugetPackage.IconUrl;
                package.ProjectUrl = nugetPackage.ProjectUrl;

        return packages;

As far as I can tell, it works on my machine!