public HashSet <NugetPackage> GetNugetPackages(string projectAssetsFilePath, bool isTestProject)
        {
            var packages = new HashSet <NugetPackage>();

            if (_fileSystem.File.Exists(projectAssetsFilePath))
            {
                var assetFileReader = new AssetFileReader();
                var assetsFile      = assetFileReader.Read(projectAssetsFilePath);

                foreach (var targetRuntime in assetsFile.Targets)
                {
                    foreach (var library in targetRuntime.Libraries)
                    {
                        if (library.Type != "project")
                        {
                            var package = new NugetPackage
                            {
                                Name         = library.Name,
                                Version      = library.Version.ToNormalizedString(),
                                Scope        = Component.ComponentScope.Required,
                                Dependencies = new Dictionary <string, string>(),
                            };
                            // is this a test project dependency or only a development dependency
                            if (
                                isTestProject ||
                                (
                                    library.CompileTimeAssemblies.Count == 0 &&
                                    library.ContentFiles.Count == 0 &&
                                    library.EmbedAssemblies.Count == 0 &&
                                    library.FrameworkAssemblies.Count == 0 &&
                                    library.NativeLibraries.Count == 0 &&
                                    library.ResourceAssemblies.Count == 0 &&
                                    library.ToolsAssemblies.Count == 0
                                )
                                )
                            {
                                package.Scope = Component.ComponentScope.Excluded;
                            }
                            // include direct dependencies
                            foreach (var dep in library.Dependencies)
                            {
                                //Get the version from the nuget package as described here: https://github.com/NuGet/NuGet.Client/blob/ad81306fe7ada265cf44afb2a60a31fbfca978a2/src/NuGet.Core/NuGet.ProjectModel/JsonUtility.cs#L54
                                package.Dependencies.Add(dep.Id, dep.VersionRange?.ToLegacyShortString());
                            }
                            packages.Add(package);
                        }
                    }
                }
            }

            return(packages);
        }
        public HashSet <NugetPackage> GetNugetPackages(string projectAssetsFilePath)
        {
            var packages = new HashSet <NugetPackage>();

            if (_fileSystem.File.Exists(projectAssetsFilePath))
            {
                var assetFileReader = new AssetFileReader();
                var assetsFile      = assetFileReader.Read(projectAssetsFilePath);

                foreach (var targetRuntime in assetsFile.Targets)
                {
                    foreach (var library in targetRuntime.Libraries)
                    {
                        if (library.Type != "project")
                        {
                            var package = new NugetPackage
                            {
                                Name    = library.Name,
                                Version = library.Version.ToNormalizedString(),
                                Scope   = "required",
                            };
                            // is this only a development dependency
                            if (
                                library.CompileTimeAssemblies.Count == 0 &&
                                library.ContentFiles.Count == 0 &&
                                library.EmbedAssemblies.Count == 0 &&
                                library.FrameworkAssemblies.Count == 0 &&
                                library.NativeLibraries.Count == 0 &&
                                library.ResourceAssemblies.Count == 0 &&
                                library.ToolsAssemblies.Count == 0
                                )
                            {
                                package.Scope = "excluded";
                            }
                            packages.Add(package);
                        }
                    }
                }
            }

            return(packages);
        }