Unable to restore nuget packages when first nuget feed doesn't have the package

I have added a local nuget feed as first one, now when opening a query which is using a package (latest version) from second (official) nuget feed, it will fail to restore the nuget package, which I believe is due to following code (decompiled from latest beta versio) from NuGet3Agent.Download:
	if (version == null)
		ProjectContextLogger logger = new ProjectContextLogger(projectContext);
		ResolutionContext getLatestContext = new ResolutionContext(1, root.MainPackageRef.AllowPrelease, false, 0);
		ResolvedPackage obj = await TaskExtensions.CAF<ResolvedPackage>(Task.Run(() => NuGetPackageManager.GetLatestVersionAsync(root.MainPackageRef.ID, folderNuGetProject, getLatestContext, sourceRepos.First(), logger, cancelToken)));
		version = ((obj != null) ? obj.get_LatestVersion() : null);
		if (version == null)
			throw new Exception("Unable to find package '" + root.MainPackageRef.ID + "'.");

Since we are always using the first feed (sourceRepos.First()) this explains why changing the order of the feeds would workaround this issue. Can we check all feeds for latest version?



  • I think you'd better switch the nuget feed order, check all feeds would causing performance issue and not make a good sense here.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!