GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Preserve archive links during installation (hardlinks on Windows, symlinks on Linux) by MichaelSimons · Pull Request #697 · dotnet/install-scripts

Conversation

@MichaelSimons

@MichaelSimons MichaelSimons commented Apr 28, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Summary

Adds tar.gz archive support to dotnet-install.ps1 on Windows for .NET 11.0+, enabling archive-level optimizations like hard links that reduce disk footprint. Falls back to .zip for older versions or when tar is unavailable.

Fixes a bug in dotnet-install.sh where symbolic links in tarballs were silently dropped during extraction.

PowerShell script changes (dotnet-install.ps1)

  • Tar detection — Test-TarAvailable checks if tar is on PATH (skippable via DOTNET_INSTALL_SKIP_TAR=1 env var)
  • Version-aware format selection — Get-FileExtension-For-Version returns .tar.gz for .NET 11.0 preview 3+ and .zip for everything else
  • Download URL construction — all download paths (SDK, runtime, aspnetcore, windowsdesktop) use the selected extension
  • aka.ms link resolution — tries .tar.gz first, falls back to .zip for symbolic channels (STS/LTS) where the version is not known upfront
  • Tar extraction — Extract-Dotnet-Package-Tar extracts with tar preserving hard links, applying the same versioned-directory skip and non-versioned file override logic as the existing zip extraction

Note on -KeepZip / -ZipPath parameter names

The existing -KeepZip and -ZipPath parameters now apply to both .zip and .tar.gz archives. The parameter names are intentionally not renamed to preserve backwards compatibility — existing scripts and automation that pass these parameters will continue to work without changes. The help text has been updated to clarify they apply to both formats.

Bash script changes (dotnet-install.sh)

The existing extract_dotnet_package function used find -type f to discover files after extracting to a temp directory. This skipped symbolic links (-type l) entirely, silently dropping them from the installation. On Linux, .NET tarballs contain relative symlinks that are important for the runtime layout.

Changes:

  • find -type f → find \( -type f -o -type l \) — symlinks are now discovered and copied
  • cp -R → cp -RP — explicitly preserves symlinks during copy (portable across GNU/BSD)
  • Destination existence checks now detect dangling symlinks via [ -L "$target" ]

Test changes

WindowsTarExtractionTests.cs (Windows-only)

Combined test class for all Windows tar extraction and format-selection scenarios:

  • Synthetic tarball extraction with hard link preservation (verified via link count, not just content)
  • Format selection: .NET 11.0+ → .tar.gz; below 11.0 → .zip
  • 11.0 preview 1-2 → .zip; preview 3+ and RC → .tar.gz
  • DOTNET_INSTALL_SKIP_TAR=1 → .zip
  • Channel-based and symbolic channel (LTS) aka.ms resolution
  • windowsdesktop runtime support
  • Verbose output reports tar availability

BashTarExtractionTests.cs (Unix-only)

Tests the bash script's extract_dotnet_package function directly using synthetic tarballs with symlinks:

  • Symlinks in versioned directories are preserved
  • Symlinks in non-versioned (root) locations are preserved
  • Versioned directories containing only symlinks are extracted (key regression test — proves find -type l is required)
  • Cross-directory relative symlinks are preserved

TarExtractionTestsBase.cs (shared base class)

Abstract base class providing shared extraction test scenarios that run on both platforms:

  • Basic extraction of versioned and non-versioned files
  • Versioned directory skip logic (existing installs not overwritten)
  • Non-versioned file override behavior (OverrideNonVersionedFiles flag)

Test infrastructure

  • Platform/prerequisite checks use Assert.SkipWhen/Assert.SkipUnless so tests report as skipped (not passed) on non-applicable platforms
  • Tarball creation uses .NET TarWriter API (no subprocess dependencies for test setup)

Open questions

  • Should we keep the 11.0 preview 1-2 special case? The script currently detects .NET 11.0 preview 1 and preview 2 and falls back to .zip since Windows tarballs were not published until preview 3. An alternative is to simplify the version logic to treat all 11.0+ the same and require users installing those old previews to set DOTNET_INSTALL_SKIP_TAR=1. This would reduce long-term maintenance of version-specific edge cases. Note: the direct-version download path (as opposed to aka.ms) does not have a .tar.gz → .zip fallback, so removing this guard would cause failures for those specific versions without the env var override.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@github-project-automation github-project-automation Bot added this to .NET Install Scripts Apr 28, 2026
@github-project-automation github-project-automation Bot moved this to Backlog in .NET Install Scripts Apr 28, 2026
@MichaelSimons
MichaelSimons force-pushed the windows-tarball-support branch 2 times, most recently from 41f0852 to 2cb67a7 Compare April 28, 2026 15:29
@MichaelSimons MichaelSimons mentioned this pull request Apr 29, 2026
Upgrade to xUnit v3 #705
Closed
Copilot AI mentioned this pull request Apr 29, 2026
Upgrade to xUnit v3 #707
Merged
@MichaelSimons MichaelSimons changed the title Support tar.gz archives on Windows for .NET 11.0+ Preserve archive links during installation (tar.gz on Windows, symlinks on Linux) May 4, 2026
@MichaelSimons
MichaelSimons force-pushed the windows-tarball-support branch 2 times, most recently from d935044 to 08cdf38 Compare May 4, 2026 14:44
@MichaelSimons
MichaelSimons requested a review from Copilot May 4, 2026 14:46
Copilot started reviewing on behalf of MichaelSimons May 4, 2026 14:47
View session
@MichaelSimons MichaelSimons changed the title Preserve archive links during installation (tar.gz on Windows, symlinks on Linux) Preserve archive links during installation (hardlinks on Windows, symlinks on Linux) May 4, 2026
Copilot AI reviewed May 4, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Enables better preservation of archive-level link semantics during installation: adds .tar.gz usage on Windows for .NET 11+ (when tar is available) and fixes Linux/macOS extraction so symlinks in tarballs aren’t silently dropped.

Changes:

  • Add tar availability detection + version-aware archive format selection (.tar.gz vs .zip) and tar extraction path to dotnet-install.ps1.
  • Fix dotnet-install.sh tar extraction to include symlinks in the file discovery step and preserve symlinks during copy.
  • Add new test coverage for tar extraction behaviors (hard links on Windows, symlinks on Unix) and allow tests to inject environment variables into the install command runner.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/Install-Scripts.Test/WindowsTarExtractionTests.cs Adds Windows tar extraction tests and format-selection (dry-run) coverage, plus a tar-vs-zip layout comparison.
tests/Install-Scripts.Test/Utils/DotNetCommand.cs Extends the test command runner to accept and apply extra environment variables.
tests/Install-Scripts.Test/TestUtils.cs Adds a helper overload to create an install command with environment variables.
tests/Install-Scripts.Test/TarExtractionTestsBase.cs Introduces shared base tests for tar extraction behaviors (skip versioned dirs, override non-versioned files, etc.).
tests/Install-Scripts.Test/BashTarExtractionTests.cs Adds Unix-only tests validating symlink preservation via dotnet-install.sh’s extraction logic.
src/dotnet-install.sh Fixes extraction to discover symlinks and preserve them when copying into the install root; improves handling of existing/dangling symlinks.
src/dotnet-install.ps1 Adds tar detection, .tar.gz URL selection for .NET 11+, aka.ms extension fallback logic, and a tar extraction implementation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread tests/Install-Scripts.Test/WindowsTarExtractionTests.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread tests/Install-Scripts.Test/WindowsTarExtractionTests.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread tests/Install-Scripts.Test/WindowsTarExtractionTests.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/dotnet-install.sh Resolved

Uh oh!

There was an error while loading. Please reload this page.

@MichaelSimons
MichaelSimons force-pushed the windows-tarball-support branch from 08cdf38 to faa6cac Compare May 4, 2026 15:13
@MichaelSimons
Preserve deduplication links in tar extraction
13e5353
- Fix symlink preservation in dotnet-install.sh by including -type l in find
- Add Windows tar extraction support with hard link preservation
- Restructure tar extraction tests with shared base class pattern:
  WindowsTarExtractionTests (PowerShell, hard links) and
  BashTarExtractionTests (bash, symlinks)
- Use .NET TarWriter API for test tarball creation instead of bash subprocesses
- Use Assert.SkipWhen/SkipUnless for platform-specific test skipping

Co-authored-by: Copilot <[email protected]>
@MichaelSimons
MichaelSimons force-pushed the windows-tarball-support branch from faa6cac to 13e5353 Compare May 4, 2026 17:10
@MichaelSimons
MichaelSimons marked this pull request as ready for review May 4, 2026 17:16
@MichaelSimons
MichaelSimons requested a review from a team as a code owner May 4, 2026 17:16
@MichaelSimons
MichaelSimons requested a review from Copilot May 4, 2026 17:16
Copilot started reviewing on behalf of MichaelSimons May 4, 2026 17:17
View session
Copilot AI reviewed May 4, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread tests/Install-Scripts.Test/BashTarExtractionTests.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/dotnet-install.ps1 Resolved

Uh oh!

There was an error while loading. Please reload this page.

@MichaelSimons
Potential fix for pull request finding
d02c62e
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
@MichaelSimons
MichaelSimons force-pushed the windows-tarball-support branch from 4f82de9 to d02c62e Compare May 4, 2026 17:34
NikolaMilosavljevic
NikolaMilosavljevic approved these changes May 4, 2026
View reviewed changes
ellahathaway
ellahathaway approved these changes May 5, 2026
View reviewed changes
@MichaelSimons
MichaelSimons merged commit 5147e32 into dotnet:main May 5, 2026
5 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@github-project-automation github-project-automation Bot moved this from Backlog to Rollout in .NET Install Scripts May 5, 2026
@MichaelSimons
MichaelSimons deleted the windows-tarball-support branch May 5, 2026 15:07
@ellahathaway ellahathaway moved this from Rollout to Done in .NET Install Scripts May 20, 2026
@MichaelSimons MichaelSimons mentioned this pull request May 21, 2026
Update install scripts to v2026.05.19 (preserve archive links) MichaelSimons/setup-dotnet#1
Closed
@MichaelSimons MichaelSimons mentioned this pull request May 21, 2026
Update install scripts to v2026.05.19 (preserve archive links) actions/setup-dotnet#736
Merged
v-HarithaVattikuti pushed a commit to actions/setup-dotnet that referenced this pull request May 26, 2026
@MichaelSimons
Update install scripts to v2026.05.19 (#736)
8404272
Update externals/install-dotnet.ps1 and externals/install-dotnet.sh to
the v2026.05.19 release of dotnet/install-scripts. This uptakes the
changes from dotnet/install-scripts#697 which preserves archive links
during installation (hardlinks on Windows, symlinks on Linux) as part
of dotnet/sdk#52182.

On Windows, .NET 11.0+ is now installed via tar.gz archives which
preserves hardlinks, significantly reducing disk space usage.

Co-authored-by: Copilot <[email protected]>
@ellahathaway ellahathaway mentioned this pull request Jul 6, 2026
Fix hash mismatch on signed dotnet-install.ps1 (non-ASCII characters) #730
Merged
ellahathaway added a commit that referenced this pull request Jul 7, 2026
@ellahathaway
Fix hash mismatch on signed dotnet-install.ps1 (#729) (#730)
4a37a9f
The signed PowerShell script contained two non-ASCII em dash characters (U+2014) in comments, introduced by #697. When Authenticode-signed without a BOM, non-ASCII content causes the file hash to fail validation across differing code pages, producing the 'hash does not match the digital signature' error under AllSigned policy. This is a recurrence of #541 (fixed in #543 by removing an emoji).

Replace the em dashes with ASCII hyphens and add a regression test that asserts both install scripts contain only ASCII bytes, guarding against a third recurrence.

Fixes #729

Co-authored-by: Copilot App <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments
+2 more reviewers
@NikolaMilosavljevic NikolaMilosavljevic NikolaMilosavljevic approved these changes
@ellahathaway ellahathaway ellahathaway approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

.NET Install Scripts
Status: Done

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@MichaelSimons @NikolaMilosavljevic @ellahathaway
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.