Merge pull request #6270 from hvitved/csharp/standalone-nuget-restore

C#: Skip `dotnet restore` in standalone extraction when `nuget_restore: false` is set
This commit is contained in:
Tom Hvitved
2021-07-13 13:36:40 +02:00
committed by GitHub

View File

@@ -108,7 +108,10 @@ namespace Semmle.BuildAnalyser
new[] { options.SolutionFile } :
sourceDir.GetFiles("*.sln", SearchOption.AllDirectories).Select(d => d.FullName);
RestoreSolutions(solutions);
if (options.UseNuGet)
{
RestoreSolutions(solutions);
}
dllDirNames.Add(packageDirectory.DirInfo.FullName);
assemblyCache = new BuildAnalyser.AssemblyCache(dllDirNames, progress);
AnalyseSolutions(solutions);
@@ -324,7 +327,16 @@ namespace Semmle.BuildAnalyser
private void Restore(string projectOrSolution)
{
var exit = DotNet.RestoreToDirectory(projectOrSolution, packageDirectory.DirInfo.FullName);
int exit;
try
{
exit = DotNet.RestoreToDirectory(projectOrSolution, packageDirectory.DirInfo.FullName);
}
catch (FileNotFoundException)
{
exit = 2;
}
switch (exit)
{
case 0: