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"). 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")