Skip to content

Commit 5517570

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

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
@@ -282,9 +282,16 @@ private static BuildScript DownloadDotNetVersion(IBuildActions actions, ILogger
282282
getInstall = version =>
283283
{
284284
var psCommand = $"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; &([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing 'https://dot.net/v1/dotnet-install.ps1'))) -Version {version} -InstallDir {path}";
285+
var environment = new Dictionary<string, string>
286+
{
287+
// Starting with .NET 11, the installation script uses tar by default. However,
288+
// tar extraction fails in dotnet-install.ps1, so force the script to download
289+
// and extract the ZIP archive instead. This workaround may be removable in the future.
290+
{"DOTNET_INSTALL_SKIP_TAR", "1"}
291+
};
285292

286293
BuildScript GetInstall(string pwsh) =>
287-
new CommandBuilder(actions).
294+
new CommandBuilder(actions, environment: environment).
288295
RunCommand(pwsh).
289296
Argument("-NoProfile").
290297
Argument("-ExecutionPolicy").

0 commit comments

Comments
 (0)