Skip to content

Commit ab9e4de

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

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
@@ -281,8 +281,15 @@ 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+
// Starting with .NET 11, the installation script uses tar by default. However,
287+
// tar extraction fails in dotnet-install.ps1, so force the script to download
288+
// and extract the ZIP archive instead. This workaround may be removable in the future.
289+
{"DOTNET_INSTALL_SKIP_TAR", "1"}
290+
};
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)