Skip to content

Commit 952fb9c

Browse files
authored
Merge pull request #22565 from michaelnebel/csharp/dotnetrc1test
C#: Very basic support for .NET 11 RC1.
2 parents ddfc131 + 8386853 commit 952fb9c

5 files changed

Lines changed: 31 additions & 1 deletion

File tree

csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/DotNet.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,9 +280,16 @@ private static BuildScript DownloadDotNetVersion(IBuildActions actions, ILogger
280280
getInstall = version =>
281281
{
282282
var psCommand = $"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; &([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing 'https://dot.net/v1/dotnet-install.ps1'))) -Version {version} -InstallDir {path}";
283+
var environment = new Dictionary<string, string>
284+
{
285+
// Starting with .NET 11, the installation script uses tar by default. However,
286+
// tar extraction fails in dotnet-install.ps1, so force the script to download
287+
// and extract the ZIP archive instead. This workaround may be removable in the future.
288+
{"DOTNET_INSTALL_SKIP_TAR", "1"}
289+
};
283290

284291
BuildScript GetInstall(string pwsh) =>
285-
new CommandBuilder(actions).
292+
new CommandBuilder(actions, environment: environment).
286293
RunCommand(pwsh).
287294
Argument("-NoProfile").
288295
Argument("-ExecutionPolicy").
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Console.WriteLine($"<arguments>{string.Join(",", args)}</arguments>");
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net11.0</TargetFramework>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<Nullable>enable</Nullable>
8+
</PropertyGroup>
9+
10+
</Project>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"sdk": {
3+
"version": "11.0.100-rc.1.26425.128"
4+
}
5+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import pytest
2+
3+
def test1(codeql, csharp):
4+
codeql.database.create()
5+
6+
def test2(codeql, csharp):
7+
codeql.database.create(build_mode="none")

0 commit comments

Comments
 (0)