Skip to content

Commit 9eed24a

Browse files
committed
C#: Use the zip archive on windows runners, when downloading and installing .NET.
1 parent 07d4698 commit 9eed24a

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

  • csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,16 @@ private static BuildScript DownloadDotNetVersion(IBuildActions actions, ILogger
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}";
283283

284+
var environment = new Dictionary<string, string>
285+
{
286+
// From .NET 11 and onwards, the installation script uses tar by default, which we want to skip on Windows.
287+
// We still want to download the .zip archive. Otherwise an error occur in https://dot.net/v1/dotnet-install.ps1
288+
// when the archive is extracted.
289+
// We might be able to remove this restriction in the future.
290+
{"DOTNET_INSTALL_SKIP_TAR", "1"}
291+
};
284292
BuildScript GetInstall(string pwsh) =>
285-
new CommandBuilder(actions).
293+
new CommandBuilder(actions, environment: environment).
286294
RunCommand(pwsh).
287295
Argument("-NoProfile").
288296
Argument("-ExecutionPolicy").

0 commit comments

Comments
 (0)