From 1dbf940d6f787b4fff1c0c7ab7fe4146cea72c61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tibor=20G=C3=B6tz?= Date: Wed, 7 Feb 2024 01:45:03 +0100 Subject: [PATCH] Only mark dotnet dependencies to be dev dependency instead of forcibly remove them. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tibor Götz --- CycloneDX.Tests/ProgramTests.cs | 4 +- .../ProjectAssetsFileServiceTests.cs | 6 +-- CycloneDX.Tests/ProjectFileServiceTests.cs | 20 +++++----- CycloneDX.Tests/ValidationTests.cs | 2 +- .../Interfaces/IProjectAssetsFileService.cs | 2 +- CycloneDX/Interfaces/IProjectFileService.cs | 4 +- CycloneDX/Interfaces/ISolutionFileService.cs | 2 +- CycloneDX/Runner.cs | 6 +-- .../Services/ProjectAssetsFileService.cs | 39 ++++++++++--------- CycloneDX/Services/ProjectFileService.cs | 10 ++--- CycloneDX/Services/SolutionFileService.cs | 4 +- 11 files changed, 51 insertions(+), 48 deletions(-) diff --git a/CycloneDX.Tests/ProgramTests.cs b/CycloneDX.Tests/ProgramTests.cs index f598aee6..7817fffd 100755 --- a/CycloneDX.Tests/ProgramTests.cs +++ b/CycloneDX.Tests/ProgramTests.cs @@ -47,7 +47,7 @@ public async Task CallingCycloneDX_CreatesOutputDirectory() }); var mockSolutionFileService = new Mock(); mockSolutionFileService - .Setup(s => s.GetSolutionDotnetDependencys(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())) + .Setup(s => s.GetSolutionDotnetDependencys(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())) .ReturnsAsync(new HashSet()); Runner runner = new Runner(fileSystem: mockFileSystem, null, null, null, null, null, solutionFileService: mockSolutionFileService.Object, null); @@ -72,7 +72,7 @@ public async Task CallingCycloneDX_WithOutputFilename_CreatesOutputFilename() }); var mockSolutionFileService = new Mock(); mockSolutionFileService - .Setup(s => s.GetSolutionDotnetDependencys(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())) + .Setup(s => s.GetSolutionDotnetDependencys(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())) .ReturnsAsync(new HashSet()); Runner runner = new Runner(fileSystem: mockFileSystem, null, null, null, null, null, solutionFileService: mockSolutionFileService.Object, null); diff --git a/CycloneDX.Tests/ProjectAssetsFileServiceTests.cs b/CycloneDX.Tests/ProjectAssetsFileServiceTests.cs index b04c233a..9ab439d5 100644 --- a/CycloneDX.Tests/ProjectAssetsFileServiceTests.cs +++ b/CycloneDX.Tests/ProjectAssetsFileServiceTests.cs @@ -236,7 +236,7 @@ public void GetDotnetDependencys_PackageAsTopLevelAndTransitive(string framework }); var projectAssetsFileService = new ProjectAssetsFileService(mockFileSystem, () => mockAssetReader.Object); - var packages = projectAssetsFileService.GetDotnetDependencys(XFS.Path(@"c:\SolutionPath\Project1\Project1.csproj"), XFS.Path(@"c:\SolutionPath\Project1\obj\project.assets.json"), false, false); + var packages = projectAssetsFileService.GetDotnetDependencys(XFS.Path(@"c:\SolutionPath\Project1\Project1.csproj"), XFS.Path(@"c:\SolutionPath\Project1\obj\project.assets.json"), false); var sortedPackages = new List(packages); sortedPackages.Sort(); @@ -396,7 +396,7 @@ public void GetDotnetDependencys_MissingResolvedPackageVersion(string framework, }); var projectAssetsFileService = new ProjectAssetsFileService(mockFileSystem, () => mockAssetReader.Object); - var packages = projectAssetsFileService.GetDotnetDependencys(XFS.Path(@"c:\SolutionPath\Project1\Project1.csproj"), XFS.Path(@"c:\SolutionPath\Project1\obj\project.assets.json"), false, false); + var packages = projectAssetsFileService.GetDotnetDependencys(XFS.Path(@"c:\SolutionPath\Project1\Project1.csproj"), XFS.Path(@"c:\SolutionPath\Project1\obj\project.assets.json"), false); var sortedPackages = new List(packages); sortedPackages.Sort(); @@ -530,7 +530,7 @@ public void GetDotnetDependencys_MissingDependencies(string framework, int frame }); var projectAssetsFileService = new ProjectAssetsFileService(mockFileSystem, () => mockAssetReader.Object); - var packages = projectAssetsFileService.GetDotnetDependencys(XFS.Path(@"c:\SolutionPath\Project1\Project1.csproj"), XFS.Path(@"c:\SolutionPath\Project1\obj\project.assets.json"), false, false); + var packages = projectAssetsFileService.GetDotnetDependencys(XFS.Path(@"c:\SolutionPath\Project1\Project1.csproj"), XFS.Path(@"c:\SolutionPath\Project1\obj\project.assets.json"), false); var sortedPackages = new List(packages); sortedPackages.Sort(); diff --git a/CycloneDX.Tests/ProjectFileServiceTests.cs b/CycloneDX.Tests/ProjectFileServiceTests.cs index 9d24e85c..255c2dd5 100755 --- a/CycloneDX.Tests/ProjectFileServiceTests.cs +++ b/CycloneDX.Tests/ProjectFileServiceTests.cs @@ -82,7 +82,7 @@ public async Task GetProjectDotnetDependencys_WithProjectAssetsFile_ReturnsDotne var mockPackageFileService = new Mock(); var mockProjectAssetsFileService = new Mock(); mockProjectAssetsFileService - .Setup(s => s.GetDotnetDependencys(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())) + .Setup(s => s.GetDotnetDependencys(It.IsAny(), It.IsAny(), It.IsAny())) .Returns(new HashSet { new DotnetDependency { Name = "Package", Version = "1.2.3" }, @@ -93,7 +93,7 @@ public async Task GetProjectDotnetDependencys_WithProjectAssetsFile_ReturnsDotne mockPackageFileService.Object, mockProjectAssetsFileService.Object); - var packages = await projectFileService.GetProjectDotnetDependencysAsync(XFS.Path(@"c:\Project\Project.csproj"), "", false, false, "", "").ConfigureAwait(true); + var packages = await projectFileService.GetProjectDotnetDependencysAsync(XFS.Path(@"c:\Project\Project.csproj"), "", false, "", "").ConfigureAwait(true); Assert.Collection(packages, item => { @@ -117,7 +117,7 @@ public async Task GetProjectDotnetDependencys_WithProjectAssetsFileWithoutRestor var mockPackageFileService = new Mock(); var mockProjectAssetsFileService = new Mock(); mockProjectAssetsFileService - .Setup(s => s.GetDotnetDependencys(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())) + .Setup(s => s.GetDotnetDependencys(It.IsAny(), It.IsAny(), It.IsAny())) .Returns(new HashSet { new DotnetDependency { Name = "Package", Version = "1.2.3" }, @@ -129,7 +129,7 @@ public async Task GetProjectDotnetDependencys_WithProjectAssetsFileWithoutRestor mockProjectAssetsFileService.Object); projectFileService.DisablePackageRestore = true; - var packages = await projectFileService.GetProjectDotnetDependencysAsync(XFS.Path(@"c:\Project\Project.csproj"), "", false, false, "", "").ConfigureAwait(true); + var packages = await projectFileService.GetProjectDotnetDependencysAsync(XFS.Path(@"c:\Project\Project.csproj"), "", false, "", "").ConfigureAwait(true); Assert.Collection(packages, item => { @@ -153,7 +153,7 @@ public async Task GetProjectDotnetDependencys_WithProjectAssetsFile_ReturnsMulti var mockPackageFileService = new Mock(); var mockProjectAssetsFileService = new Mock(); mockProjectAssetsFileService - .Setup(s => s.GetDotnetDependencys(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())) + .Setup(s => s.GetDotnetDependencys(It.IsAny(), It.IsAny(), It.IsAny())) .Returns(new HashSet { new DotnetDependency { Name = "Package1", Version = "1.2.3" }, @@ -166,7 +166,7 @@ public async Task GetProjectDotnetDependencys_WithProjectAssetsFile_ReturnsMulti mockPackageFileService.Object, mockProjectAssetsFileService.Object); - var packages = await projectFileService.GetProjectDotnetDependencysAsync(XFS.Path(@"c:\Project\Project.csproj"), "", false, false, "", "").ConfigureAwait(true); + var packages = await projectFileService.GetProjectDotnetDependencysAsync(XFS.Path(@"c:\Project\Project.csproj"), "", false, "", "").ConfigureAwait(true); var sortedPackages = new List(packages); sortedPackages.Sort(); @@ -199,7 +199,7 @@ public async Task GetProjectDotnetDependencys_WithPackagesConfig_ReturnsDotnetDe ); var mockProjectAssetsFileService = new Mock(); mockProjectAssetsFileService - .Setup(s => s.GetDotnetDependencys(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())) + .Setup(s => s.GetDotnetDependencys(It.IsAny(), It.IsAny(), It.IsAny())) .Returns(new HashSet()); var projectFileService = new ProjectFileService( mockFileSystem, @@ -207,7 +207,7 @@ public async Task GetProjectDotnetDependencys_WithPackagesConfig_ReturnsDotnetDe mockPackageFileService.Object, mockProjectAssetsFileService.Object); - var packages = await projectFileService.GetProjectDotnetDependencysAsync(XFS.Path(@"c:\Project\Project.csproj"), "", false, false, "", "").ConfigureAwait(true); + var packages = await projectFileService.GetProjectDotnetDependencysAsync(XFS.Path(@"c:\Project\Project.csproj"), "", false, "", "").ConfigureAwait(true); Assert.Collection(packages, item => { @@ -241,7 +241,7 @@ public async Task GetProjectDotnetDependencys_WithPackagesConfig_ReturnsMultiple ); var mockProjectAssetsFileService = new Mock(); mockProjectAssetsFileService - .Setup(s => s.GetDotnetDependencys(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())) + .Setup(s => s.GetDotnetDependencys(It.IsAny(), It.IsAny(), It.IsAny())) .Returns(new HashSet()); var projectFileService = new ProjectFileService( mockFileSystem, @@ -249,7 +249,7 @@ public async Task GetProjectDotnetDependencys_WithPackagesConfig_ReturnsMultiple mockPackageFileService.Object, mockProjectAssetsFileService.Object); - var packages = await projectFileService.GetProjectDotnetDependencysAsync(XFS.Path(@"c:\Project\Project.csproj"), "", false, false, "", "").ConfigureAwait(true); + var packages = await projectFileService.GetProjectDotnetDependencysAsync(XFS.Path(@"c:\Project\Project.csproj"), "", false, "", "").ConfigureAwait(true); var sortedPackages = new List(packages); sortedPackages.Sort(); diff --git a/CycloneDX.Tests/ValidationTests.cs b/CycloneDX.Tests/ValidationTests.cs index ed1a3e97..6c73693e 100644 --- a/CycloneDX.Tests/ValidationTests.cs +++ b/CycloneDX.Tests/ValidationTests.cs @@ -38,7 +38,7 @@ public async Task Validation(string fileFormat, bool disableGitHubLicenses) var mockProjectFileService = new Mock(); mockProjectFileService.Setup(mock => - mock.GetProjectDotnetDependencysAsync(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny()) + mock.GetProjectDotnetDependencysAsync(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny()) ).ReturnsAsync(packages); Runner runner = new Runner(fileSystem: mockFileSystem, null, null, null, null, projectFileService: mockProjectFileService.Object, solutionFileService: null, null); diff --git a/CycloneDX/Interfaces/IProjectAssetsFileService.cs b/CycloneDX/Interfaces/IProjectAssetsFileService.cs index 53155de2..cc300ae8 100644 --- a/CycloneDX/Interfaces/IProjectAssetsFileService.cs +++ b/CycloneDX/Interfaces/IProjectAssetsFileService.cs @@ -22,6 +22,6 @@ namespace CycloneDX.Interfaces { public interface IProjectAssetsFileService { - HashSet GetDotnetDependencys(string projectFilePath, string projectAssetsFilePath, bool IsTestProject, bool excludeDevDependencies); + HashSet GetDotnetDependencys(string projectFilePath, string projectAssetsFilePath, bool IsTestProject); } } diff --git a/CycloneDX/Interfaces/IProjectFileService.cs b/CycloneDX/Interfaces/IProjectFileService.cs index 8265efa8..7a6728c2 100755 --- a/CycloneDX/Interfaces/IProjectFileService.cs +++ b/CycloneDX/Interfaces/IProjectFileService.cs @@ -24,9 +24,9 @@ namespace CycloneDX.Interfaces public interface IProjectFileService { bool DisablePackageRestore { get; set; } - Task> GetProjectDotnetDependencysAsync(string projectFilePath, string baseIntermediateOutputPath, bool excludeTestProjects, bool excludeDevDependencies, string framework, string runtime); + Task> GetProjectDotnetDependencysAsync(string projectFilePath, string baseIntermediateOutputPath, bool excludeTestProjects, string framework, string runtime); Task> GetProjectReferencesAsync(string projectFilePath); - Task> RecursivelyGetProjectDotnetDependencysAsync(string projectFilePath, string baseIntermediateOutputPath, bool excludeTestProjects, bool excludeDevDependencies, string framework, string runtime); + Task> RecursivelyGetProjectDotnetDependencysAsync(string projectFilePath, string baseIntermediateOutputPath, bool excludeTestProjects, string framework, string runtime); Task> RecursivelyGetProjectReferencesAsync(string projectFilePath); Component GetComponent(DotnetDependency dotnetDependency); bool IsTestProject(string projectFilePath); diff --git a/CycloneDX/Interfaces/ISolutionFileService.cs b/CycloneDX/Interfaces/ISolutionFileService.cs index c31b7e77..8c9f1849 100755 --- a/CycloneDX/Interfaces/ISolutionFileService.cs +++ b/CycloneDX/Interfaces/ISolutionFileService.cs @@ -24,6 +24,6 @@ namespace CycloneDX.Interfaces public interface ISolutionFileService { Task> GetSolutionProjectReferencesAsync(string solutionFilePath); - Task> GetSolutionDotnetDependencys(string solutionFilePath, string baseIntermediateOutputPath, bool excludeTestProjects, bool excludeDevDependencies, string framework, string runtime); + Task> GetSolutionDotnetDependencys(string solutionFilePath, string baseIntermediateOutputPath, bool excludeTestProjects, string framework, string runtime); } } diff --git a/CycloneDX/Runner.cs b/CycloneDX/Runner.cs index 98042afe..eaef36be 100644 --- a/CycloneDX/Runner.cs +++ b/CycloneDX/Runner.cs @@ -164,17 +164,17 @@ public async Task HandleCommandAsync(RunOptions options) { if (SolutionOrProjectFile.ToLowerInvariant().EndsWith(".sln", StringComparison.OrdinalIgnoreCase)) { - packages = await solutionFileService.GetSolutionDotnetDependencys(fullSolutionOrProjectFilePath, baseIntermediateOutputPath, excludetestprojects, excludeDev, framework, runtime).ConfigureAwait(false); + packages = await solutionFileService.GetSolutionDotnetDependencys(fullSolutionOrProjectFilePath, baseIntermediateOutputPath, excludetestprojects, framework, runtime).ConfigureAwait(false); topLevelComponent.Name = fileSystem.Path.GetFileNameWithoutExtension(SolutionOrProjectFile); } else if (Utils.IsSupportedProjectType(SolutionOrProjectFile) && scanProjectReferences) { - packages = await projectFileService.RecursivelyGetProjectDotnetDependencysAsync(fullSolutionOrProjectFilePath, baseIntermediateOutputPath, excludetestprojects, excludeDev, framework, runtime).ConfigureAwait(false); + packages = await projectFileService.RecursivelyGetProjectDotnetDependencysAsync(fullSolutionOrProjectFilePath, baseIntermediateOutputPath, excludetestprojects, framework, runtime).ConfigureAwait(false); topLevelComponent.Name = fileSystem.Path.GetFileNameWithoutExtension(SolutionOrProjectFile); } else if (Utils.IsSupportedProjectType(SolutionOrProjectFile)) { - packages = await projectFileService.GetProjectDotnetDependencysAsync(fullSolutionOrProjectFilePath, baseIntermediateOutputPath, excludetestprojects, excludeDev, framework, runtime).ConfigureAwait(false); + packages = await projectFileService.GetProjectDotnetDependencysAsync(fullSolutionOrProjectFilePath, baseIntermediateOutputPath, excludetestprojects, framework, runtime).ConfigureAwait(false); topLevelComponent.Name = fileSystem.Path.GetFileNameWithoutExtension(SolutionOrProjectFile); } else if (this.fileSystem.Path.GetFileName(SolutionOrProjectFile).ToLowerInvariant().Equals("packages.config", StringComparison.OrdinalIgnoreCase)) diff --git a/CycloneDX/Services/ProjectAssetsFileService.cs b/CycloneDX/Services/ProjectAssetsFileService.cs index 14902228..5f634ee1 100644 --- a/CycloneDX/Services/ProjectAssetsFileService.cs +++ b/CycloneDX/Services/ProjectAssetsFileService.cs @@ -17,14 +17,14 @@ using System; using System.Collections.Generic; +using System.IO; using System.IO.Abstractions; -using CycloneDX.Models; using System.Linq; using CycloneDX.Interfaces; -using NuGet.Versioning; +using CycloneDX.Models; using NuGet.LibraryModel; using NuGet.ProjectModel; -using System.IO; +using NuGet.Versioning; namespace CycloneDX.Services { @@ -39,7 +39,7 @@ public ProjectAssetsFileService(IFileSystem fileSystem, Func a _assetFileReaderFactory = assetFileReaderFactory; } - public HashSet GetDotnetDependencys(string projectFilePath, string projectAssetsFilePath, bool isTestProject, bool excludeDevDependencies) + public HashSet GetDotnetDependencys(string projectFilePath, string projectAssetsFilePath, bool isTestProject) { var packages = new HashSet(); @@ -100,21 +100,21 @@ public HashSet GetDotnetDependencys(string projectFilePath, st var allPackages = runtimePackages.Select(p => p.Name); var packagesNotInAllPackages = allDependencies.Except(allPackages); - if (excludeDevDependencies) + var realRuntimePackages = new HashSet(); + foreach (DotnetDependency dd in runtimePackages) { - var realRuntimePackages = new HashSet(); - foreach (DotnetDependency dd in runtimePackages) + if (!dd.IsDirectReference) { - if (!dd.IsDirectReference) - { - continue; - } - - ResolvedRuntimeDependencies(dd, runtimePackages, realRuntimePackages); + continue; } - runtimePackages = realRuntimePackages; - } - + + ResolvedRuntimeDependencies(dd, runtimePackages, realRuntimePackages); + } + foreach (DotnetDependency dd in runtimePackages.Except(realRuntimePackages)) + { + dd.IsDevDependency = true; + } + // Check if there is an "unresolved" dependency on NetStandard if (packagesNotInAllPackages.Any(p => p == "NETStandard.Library")) { @@ -159,8 +159,11 @@ private static void ResolvedRuntimeDependencies(DotnetDependency dotnetDependenc foreach (KeyValuePair child in dotnetDependency.Dependencies) { - DotnetDependency childDependency = allpackages.First(p => string.Equals(p.Name, child.Key, StringComparison.OrdinalIgnoreCase)); - ResolvedRuntimeDependencies(childDependency, allpackages, collectedDependencies); + DotnetDependency childDependency = allpackages.FirstOrDefault(p => string.Equals(p.Name, child.Key, StringComparison.OrdinalIgnoreCase)); + if (childDependency != null) + { + ResolvedRuntimeDependencies(childDependency, allpackages, collectedDependencies); + } } } diff --git a/CycloneDX/Services/ProjectFileService.cs b/CycloneDX/Services/ProjectFileService.cs index 58c3d1f7..27570877 100755 --- a/CycloneDX/Services/ProjectFileService.cs +++ b/CycloneDX/Services/ProjectFileService.cs @@ -148,7 +148,7 @@ static internal string GetProjectProperty(string projectFilePath, string baseInt /// /// /// - public async Task> GetProjectDotnetDependencysAsync(string projectFilePath, string baseIntermediateOutputPath, bool excludeTestProjects, bool excludeDevDependencies, string framework, string runtime) + public async Task> GetProjectDotnetDependencysAsync(string projectFilePath, string baseIntermediateOutputPath, bool excludeTestProjects, string framework, string runtime) { if (!_fileSystem.File.Exists(projectFilePath)) { @@ -189,7 +189,7 @@ public async Task> GetProjectDotnetDependencysAsync(st { Console.WriteLine($"File not found: \"{assetsFilename}\", \"{projectFilePath}\" "); } - var packages = _projectAssetsFileService.GetDotnetDependencys(projectFilePath, assetsFilename, isTestProject, excludeDevDependencies); + var packages = _projectAssetsFileService.GetDotnetDependencys(projectFilePath, assetsFilename, isTestProject); // if there are no project file package references look for a packages.config @@ -212,9 +212,9 @@ public async Task> GetProjectDotnetDependencysAsync(st /// /// /// - public async Task> RecursivelyGetProjectDotnetDependencysAsync(string projectFilePath, string baseIntermediateOutputPath, bool excludeTestProjects, bool excludeDevDependencies, string framework, string runtime) + public async Task> RecursivelyGetProjectDotnetDependencysAsync(string projectFilePath, string baseIntermediateOutputPath, bool excludeTestProjects, string framework, string runtime) { - var dotnetDependencys = await GetProjectDotnetDependencysAsync(projectFilePath, baseIntermediateOutputPath, excludeTestProjects, excludeDevDependencies, framework, runtime).ConfigureAwait(false); + var dotnetDependencys = await GetProjectDotnetDependencysAsync(projectFilePath, baseIntermediateOutputPath, excludeTestProjects, framework, runtime).ConfigureAwait(false); foreach (var item in dotnetDependencys) { item.IsDirectReference = true; @@ -230,7 +230,7 @@ public async Task> RecursivelyGetProjectDotnetDependen foreach (var project in projectReferences) { - var projectDotnetDependencys = await GetProjectDotnetDependencysAsync(project.Path, baseIntermediateOutputPath, excludeTestProjects, excludeDevDependencies, framework, runtime).ConfigureAwait(false); + var projectDotnetDependencys = await GetProjectDotnetDependencysAsync(project.Path, baseIntermediateOutputPath, excludeTestProjects, framework, runtime).ConfigureAwait(false); //Add dependencies for dependency graph foreach (var dependency in projectDotnetDependencys) diff --git a/CycloneDX/Services/SolutionFileService.cs b/CycloneDX/Services/SolutionFileService.cs index bf0eded2..bddb211e 100755 --- a/CycloneDX/Services/SolutionFileService.cs +++ b/CycloneDX/Services/SolutionFileService.cs @@ -82,7 +82,7 @@ public async Task> GetSolutionProjectReferencesAsync(string solu /// /// /// - public async Task> GetSolutionDotnetDependencys(string solutionFilePath, string baseIntermediateOutputPath, bool excludeTestProjects, bool excludeDevDependencies, string framework, string runtime) + public async Task> GetSolutionDotnetDependencys(string solutionFilePath, string baseIntermediateOutputPath, bool excludeTestProjects, string framework, string runtime) { if (!_fileSystem.File.Exists(solutionFilePath)) { @@ -113,7 +113,7 @@ public async Task> GetSolutionDotnetDependencys(string foreach (var projectFilePath in projectQuery) { Console.WriteLine(); - var projectPackages = await _projectFileService.GetProjectDotnetDependencysAsync(projectFilePath, baseIntermediateOutputPath, excludeTestProjects, excludeDevDependencies, framework, runtime).ConfigureAwait(false); + var projectPackages = await _projectFileService.GetProjectDotnetDependencysAsync(projectFilePath, baseIntermediateOutputPath, excludeTestProjects, framework, runtime).ConfigureAwait(false); directReferencePackages.UnionWith(projectPackages.Where(p => p.IsDirectReference)); packages.UnionWith(projectPackages); }