C#: Use nuget.config file for dotnet restore fallback logic

This commit is contained in:
Tamas Vajk
2023-07-07 13:49:28 +02:00
parent 139585fe5c
commit 23f3e44fa1
3 changed files with 37 additions and 9 deletions

View File

@@ -45,9 +45,11 @@ namespace Semmle.BuildAnalyser
return true;
}
public bool RestoreToDirectory(string projectOrSolutionFile, string packageDirectory)
public bool RestoreToDirectory(string projectOrSolutionFile, string packageDirectory, string? pathToNugetConfig = null)
{
var args = $"restore --no-dependencies \"{projectOrSolutionFile}\" --packages \"{packageDirectory}\" /p:DisableImplicitNuGetFallbackFolder=true";
if (pathToNugetConfig != null)
args += $" --configfile \"{pathToNugetConfig}\"";
return RunCommand(args);
}