Skip to content

Commit bd5f531

Browse files
committed
C#: Pass .dotnet path to standalone extractor
1 parent 37535d1 commit bd5f531

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

csharp/autobuilder/Semmle.Autobuild.CSharp/CSharpAutobuilder.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ public override BuildScript GetBuildScript()
4848
attempt = new BuildCommandRule(DotNetRule.WithDotNet).Analyse(this, false) & CheckExtractorRun(true);
4949
break;
5050
case CSharpBuildStrategy.Buildless:
51-
attempt = DotNetRule.WithDotNet(this, env =>
51+
attempt = DotNetRule.WithDotNet(this, (dotNetPath, env) =>
5252
{
5353
// No need to check that the extractor has been executed in buildless mode
54-
return new StandaloneBuildRule().Analyse(this, false);
54+
return new StandaloneBuildRule(dotNetPath).Analyse(this, false);
5555
});
5656
break;
5757
case CSharpBuildStrategy.MSBuild:

csharp/autobuilder/Semmle.Autobuild.CSharp/StandaloneBuildRule.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ namespace Semmle.Autobuild.CSharp
88
/// </summary>
99
internal class StandaloneBuildRule : IBuildRule<CSharpAutobuildOptions>
1010
{
11+
private readonly string? dotNetPath;
12+
13+
internal StandaloneBuildRule(string? dotNetPath)
14+
{
15+
this.dotNetPath = dotNetPath;
16+
}
17+
1118
public BuildScript Analyse(IAutobuilder<CSharpAutobuildOptions> builder, bool auto)
1219
{
1320
BuildScript GetCommand(string? solution)
@@ -35,6 +42,12 @@ BuildScript GetCommand(string? solution)
3542
cmd.Argument("--skip-nuget");
3643
}
3744

45+
if (!string.IsNullOrEmpty(this.dotNetPath))
46+
{
47+
cmd.Argument("--dotnet");
48+
cmd.QuoteArgument(this.dotNetPath);
49+
}
50+
3851
return cmd.Script;
3952
}
4053

0 commit comments

Comments
 (0)