From 07d46983c72e5b7c07111543093a3179707bc268 Mon Sep 17 00:00:00 2001 From: Michael Nebel Date: Tue, 15 Sep 2026 09:47:58 +0200 Subject: [PATCH 1/2] C#: Add extraction test for .NET 11 RC1. --- .../all-platforms/dotnet_11/Program.cs | 1 + .../all-platforms/dotnet_11/dotnet_build.csproj | 10 ++++++++++ .../all-platforms/dotnet_11/global.json | 5 +++++ .../integration-tests/all-platforms/dotnet_11/test.py | 7 +++++++ 4 files changed, 23 insertions(+) create mode 100644 csharp/ql/integration-tests/all-platforms/dotnet_11/Program.cs create mode 100644 csharp/ql/integration-tests/all-platforms/dotnet_11/dotnet_build.csproj create mode 100644 csharp/ql/integration-tests/all-platforms/dotnet_11/global.json create mode 100644 csharp/ql/integration-tests/all-platforms/dotnet_11/test.py diff --git a/csharp/ql/integration-tests/all-platforms/dotnet_11/Program.cs b/csharp/ql/integration-tests/all-platforms/dotnet_11/Program.cs new file mode 100644 index 000000000000..bd44629f7e23 --- /dev/null +++ b/csharp/ql/integration-tests/all-platforms/dotnet_11/Program.cs @@ -0,0 +1 @@ +Console.WriteLine($"{string.Join(",", args)}"); diff --git a/csharp/ql/integration-tests/all-platforms/dotnet_11/dotnet_build.csproj b/csharp/ql/integration-tests/all-platforms/dotnet_11/dotnet_build.csproj new file mode 100644 index 000000000000..5bf6c9b8cff2 --- /dev/null +++ b/csharp/ql/integration-tests/all-platforms/dotnet_11/dotnet_build.csproj @@ -0,0 +1,10 @@ + + + + Exe + net11.0 + enable + enable + + + diff --git a/csharp/ql/integration-tests/all-platforms/dotnet_11/global.json b/csharp/ql/integration-tests/all-platforms/dotnet_11/global.json new file mode 100644 index 000000000000..f79f89df7d1a --- /dev/null +++ b/csharp/ql/integration-tests/all-platforms/dotnet_11/global.json @@ -0,0 +1,5 @@ +{ + "sdk": { + "version": "11.0.100-rc.1.26425.128" + } +} diff --git a/csharp/ql/integration-tests/all-platforms/dotnet_11/test.py b/csharp/ql/integration-tests/all-platforms/dotnet_11/test.py new file mode 100644 index 000000000000..1f1fe52a4e5e --- /dev/null +++ b/csharp/ql/integration-tests/all-platforms/dotnet_11/test.py @@ -0,0 +1,7 @@ +import pytest + +def test1(codeql, csharp): + codeql.database.create() + +def test2(codeql, csharp): + codeql.database.create(build_mode="none") From 838685316d24e18ac665485f8f9d4bfd648d7040 Mon Sep 17 00:00:00 2001 From: Michael Nebel Date: Tue, 15 Sep 2026 11:25:50 +0200 Subject: [PATCH 2/2] C#: Use the zip archive on windows runners, when downloading and installing .NET. --- .../DotNet.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/DotNet.cs b/csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/DotNet.cs index babb811b25f0..f1cae33853a1 100644 --- a/csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/DotNet.cs +++ b/csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/DotNet.cs @@ -280,9 +280,16 @@ private static BuildScript DownloadDotNetVersion(IBuildActions actions, ILogger getInstall = version => { var psCommand = $"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; &([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing 'https://dot.net/v1/dotnet-install.ps1'))) -Version {version} -InstallDir {path}"; + var environment = new Dictionary + { + // Starting with .NET 11, the installation script uses tar by default. However, + // tar extraction fails in dotnet-install.ps1, so force the script to download + // and extract the ZIP archive instead. This workaround may be removable in the future. + {"DOTNET_INSTALL_SKIP_TAR", "1"} + }; BuildScript GetInstall(string pwsh) => - new CommandBuilder(actions). + new CommandBuilder(actions, environment: environment). RunCommand(pwsh). Argument("-NoProfile"). Argument("-ExecutionPolicy").