Skip to content

Add support for customized nuget globalPackagesFolder #1424

@gmnl

Description

@gmnl

Using a nuget.config file with a custom globalPackagesFolder, the metadata of the referenced nuget packages will not be resolved.

Example for such a nuget.config file:

<?xml version="1.0" encoding="utf-8"?>
<!-- Adds the relative path Extern/NugetPackageFeed to the package sources -->
<!-- this file is merged with the user nuget settings and the settings in the .nuget dir of the solution -->
<configuration>
  <config>
    <add key="globalPackagesFolder" value="C:\SharedNugetPackages" />
  </config>
</configuration>

Proposed change: The NugetUtils class could be adapted:

  • add new parameter Microsoft.Sbom.Common.Config.IConfiguration configuration to the constructor
  • resolve the correct folder with customPackagePath = SettingsUtility.GetGlobalPackagesFolder(Settings.LoadDefaultSettings(this.configuration.BuildComponentPath.Value));
  • use customPackagePath as a fallback solution to resolve the nuspecLocation in method NugetUtils.GetMetadataLocation

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions