C#: Check fallback nuget feeds before trying to use them in the fallback restore process

This commit is contained in:
Tamas Vajk
2024-04-09 15:01:20 +02:00
parent 161f586510
commit 0f7fc90fe0
10 changed files with 180 additions and 31 deletions

View File

@@ -95,9 +95,9 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
public IList<string> GetListedSdks() => GetResultList("--list-sdks");
private IList<string> GetResultList(string args)
private IList<string> GetResultList(string args, string? workingDirectory = null)
{
if (dotnetCliInvoker.RunCommand(args, out var results))
if (dotnetCliInvoker.RunCommand(args, workingDirectory, out var results))
{
return results;
}
@@ -111,7 +111,11 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
return dotnetCliInvoker.RunCommand(args);
}
public IList<string> GetNugetFeeds(string nugetConfig) => GetResultList($"nuget list source --format Short --configfile \"{nugetConfig}\"");
private const string nugetListSourceCommand = "nuget list source --format Short";
public IList<string> GetNugetFeeds(string nugetConfig) => GetResultList($"{nugetListSourceCommand} --configfile \"{nugetConfig}\"");
public IList<string> GetNugetFeedsFromFolder(string folderPath) => GetResultList(nugetListSourceCommand, folderPath);
// The version number should be kept in sync with the version .NET version used for building the application.
public const string LatestDotNetSdkVersion = "8.0.101";