Investigate consolidating ReplaceFilesWithSymbolicLinks into DeduplicateAssembliesWithLinks
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 1.3k
- PR merge metrics
- PR metrics pending
Description
### Background
We now have two tasks that deduplicate files in the SDK layout by creating symbolic links:
| | **ReplaceFilesWithSymbolicLinks** | **DeduplicateAssembliesWithLinks** |
|---|---|---|
| **Input** | Two directories: `Directory` and `LinkToFilesFrom` | Single directory: `LayoutDirectory` |
| **Matching** | By **filename** (then verifies content) | By **content hash** (filenames can differ) |
| **Scope** | Links files from one known location to another | Finds duplicates anywhere in the tree |
| **Platform** | Unix only | Cross-platform |
| **Link type** | Symlinks only | Hard links or symlinks |
| **File types** | All files | Assemblies only (.dll/.exe) |
`ReplaceFilesWithSymbolicLinks` is used specifically to link runtime pack files to shared framework files, while `DeduplicateAssembliesWithLinks` is a general-purpose
deduplication task.
### Proposal
Investigate whether `ReplaceFilesWithSymbolicLinks` can be removed in favor of `DeduplicateAssembliesWithLinks`, which would:
- Simplify maintenance (one task instead of two)
- Provide cross-platform support (including Windows)
- Use a more robust content-hash-based approach
### Investigation needed
1. **Determine what file types are actually linked by `ReplaceFilesWithSymbolicLinks`**
- If only assemblies (.dll/.exe), `DeduplicateAssembliesWithLinks` already covers this
- If native libraries or other files are linked, `DeduplicateAssembliesWithLinks` would need to be extended
2. **Verify primary selection works correctly**
- `DeduplicateAssembliesWithLinks` selects the primary by depth (shallowest) then alphabetically
- Shared framework files should be selected over runtime pack files (they're at a shallower depth)
3. **Consider extending `DeduplicateAssembliesWithLinks`** to handle native libraries (`.so`, `.dylib`) if needed
### Related
- `ReplaceFilesWithSymbolicLinks`: `src/Tasks/sdk-tasks/ReplaceFilesWithSymbolicLinks.cs`
- `DeduplicateAssembliesWithLinks`: `src/Tasks/sdk-tasks/DeduplicateAssembliesWithLinks.cs`
- Usage in `GenerateInstallerLayout.targets`
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.