C#: Skip dotnet restore in standalone extraction when nuget_restore: false is set

This commit is contained in:
Tom Hvitved
2021-07-12 15:16:16 +02:00
parent db4c8dfd3c
commit 6ba6d9931c

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: