private IEnumerable <PackageReference> BuildPackageReferences(TargetFrameworkGroup targetFrameworkGroup)
        {
            foreach (var(packageId, packageVersions) in targetFrameworkGroup)
            {
                if (packageVersions.Count > 1)
                {
                    Console.Error.WriteLine($"Package version conflict: see package {packageId}");
                }

                foreach (var packageVersion in packageVersions)
                {
                    yield return(new PackageReference(packageId, packageVersion));
                }
            }
        }
        public void AddPackage(string targetFramework, string packageId, string packageVersion)
        {
            if (!_packageReferencesByTargetFramework.TryGetValue(targetFramework, out var targetFrameworkGroup))
            {
                targetFrameworkGroup = new TargetFrameworkGroup();
                _packageReferencesByTargetFramework.Add(targetFramework, targetFrameworkGroup);
            }

            if (!targetFrameworkGroup.TryGetValue(packageId, out var packageGroup))
            {
                packageGroup = new PackageGroup();
                targetFrameworkGroup.Add(packageId, packageGroup);
            }

            packageGroup.Add(packageVersion);
        }