Skip to content

Commit 8386853

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

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

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

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

0 commit comments

Comments
 (0)