Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ internal class PackagesConfigRestoreFactory
{
public static IPackagesConfigRestore Create(IFileProvider fileProvider, DependencyDirectory packageDirectory, Semmle.Util.Logging.ILogger logger, FeedManager feedManager)
{
if (SystemBuildActions.Instance.IsWindows() || SystemBuildActions.Instance.IsMonoInstalled())
if ((SystemBuildActions.Instance.IsWindows() || SystemBuildActions.Instance.IsMonoInstalled()) && !feedManager.HasPrivateRegistryFeeds)

@michaelnebel michaelnebel Oct 28, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When private registries are configured, we assume that these registries will contain the access to the bulk of the dependencies, which means that any attempt to restore a package using the NuGet CLI will most likely fail with an unauthorized error.
It would be a good improvement, if we also made the dotnet restore logic version aware, but it is out of scope for this PR.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is a good point (co-incidentally I was looking into converting the FileContent parser to XML as well), but that is a general improvement as well and out of scope for this PR.

{
return new NugetExeWrapper(fileProvider, packageDirectory, logger, feedManager);
}
Expand Down Expand Up @@ -252,7 +252,7 @@ public int InstallPackages()
{
if (PackageCount > 0)
{
logger.LogInfo("Found packages.config files, but nuget.exe cannot be used to restore packages on this platform. Skipping restore of packages.config files.");
logger.LogInfo("Found packages.config files, but nuget.exe cannot be used to restore packages on this platform or if private registry feeds are configured. Skipping restore of packages.config files.");
}
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
category: minorAnalysis
---

- When private NuGet registries are configured, the extractor now attempts to restore dependencies listed in `packages.config` files using `dotnet restore` instead of the NuGet CLI so that the private registry configuration is respected.
Loading