Consolidate NETFRAMEWORK/NETSTANDARD compile flags into LEGACY_DOTNET#1135
Merged
adamhathcock merged 5 commits intomasterfrom Jan 15, 2026
Merged
Consolidate NETFRAMEWORK/NETSTANDARD compile flags into LEGACY_DOTNET#1135adamhathcock merged 5 commits intomasterfrom
adamhathcock merged 5 commits intomasterfrom
Conversation
Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
… NETCOREAPP2_1 pattern Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Consolidate NETFRAMEWORK and NETSTANDARD compile flags
Consolidate NETFRAMEWORK/NETSTANDARD compile flags into LEGACY_DOTNET
Jan 15, 2026
adamhathcock
approved these changes
Jan 15, 2026
Owner
|
@copilot make the dotnet 6 or greater flag be dotnet 8 or greater |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR consolidates scattered compile-time conditional directives by introducing a unified LEGACY_DOTNET constant to distinguish between legacy frameworks (net48, netstandard20) and modern .NET (net8.0, net10.0). This refactoring improves code maintainability by replacing 45+ occurrences of complex flag combinations with a single, clearly-named constant.
Changes:
- Added
LEGACY_DOTNETcompile constant in the project file for net48 and netstandard20 targets - Replaced complex combinations of
NETFRAMEWORK/NETSTANDARDflags throughout the codebase withLEGACY_DOTNETor!LEGACY_DOTNET - Removed obsolete
NETCF(NET Compact Framework) references - Fixed typo in compile constant:
NET60_OR_GREATER→NET6_0_OR_GREATER - Updated Microsoft.NET.ILLink.Tasks package from 10.0.0 to 10.0.1
Reviewed changes
Copilot reviewed 33 out of 33 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/SharpCompress/SharpCompress.csproj | Defines LEGACY_DOTNET constant for net48 and netstandard20 targets |
| src/SharpCompress/packages.lock.json | Updates ILLink.Tasks package version |
| src/SharpCompress/Utility.cs | Fixes NET6_0_OR_GREATER typo |
| src/SharpCompress/Readers/AbstractReader.cs | Replaces NETFRAMEWORK||NETSTANDARD2_0 with LEGACY_DOTNET |
| src/SharpCompress/Polyfills/StringExtensions.cs | Replaces NETFRAMEWORK||NETSTANDARD2_0 with LEGACY_DOTNET |
| src/SharpCompress/NotNullExtensions.cs | Replaces NETFRAMEWORK||NETSTANDARD with LEGACY_DOTNET |
| src/SharpCompress/IO/SourceStream.cs | Replaces !NETFRAMEWORK&&!NETSTANDARD2_0 with !LEGACY_DOTNET |
| src/SharpCompress/IO/SharpCompressStream.cs | Replaces !NETFRAMEWORK&&!NETSTANDARD2_0 with !LEGACY_DOTNET |
| src/SharpCompress/IO/ReadOnlySubStream.cs | Replaces !NETFRAMEWORK&&!NETSTANDARD2_0 with !LEGACY_DOTNET |
| src/SharpCompress/IO/ProgressReportingStream.cs | Replaces !NETFRAMEWORK&&!NETSTANDARD2_0 with !LEGACY_DOTNET |
| src/SharpCompress/IO/BufferedSubStream.cs | Replaces !NETFRAMEWORK&&!NETSTANDARD2_0 with !LEGACY_DOTNET |
| src/SharpCompress/Crypto/Crc32Stream.cs | Replaces !NETFRAMEWORK&&!NETSTANDARD2_0 with !LEGACY_DOTNET |
| src/SharpCompress/Compressors/ZStandard/DecompressionStream.cs | Replaces !NETSTANDARD2_0&&!NETFRAMEWORK with !LEGACY_DOTNET |
| src/SharpCompress/Compressors/ZStandard/CompressionStream.cs | Replaces !NETSTANDARD2_0&&!NETFRAMEWORK with !LEGACY_DOTNET |
| src/SharpCompress/Compressors/Rar/RarStream.cs | Replaces NETCOREAPP2_1_OR_GREATER||NETSTANDARD2_1_OR_GREATER with !LEGACY_DOTNET |
| src/SharpCompress/Compressors/Rar/RarCrcStream.cs | Replaces NETCOREAPP2_1_OR_GREATER||NETSTANDARD2_1_OR_GREATER with !LEGACY_DOTNET |
| src/SharpCompress/Compressors/Rar/RarBLAKE2spStream.cs | Replaces NETCOREAPP2_1_OR_GREATER||NETSTANDARD2_1_OR_GREATER with !LEGACY_DOTNET |
| src/SharpCompress/Compressors/Rar/MultiVolumeReadOnlyStream.cs | Replaces NETCOREAPP2_1_OR_GREATER||NETSTANDARD2_1_OR_GREATER with !LEGACY_DOTNET |
| src/SharpCompress/Compressors/LZMA/LzmaStream.cs | Replaces !NETFRAMEWORK&&!NETSTANDARD2_0 with !LEGACY_DOTNET |
| src/SharpCompress/Compressors/LZMA/LzmaDecoder.cs | Replaces !NETFRAMEWORK&&!NETSTANDARD2_0 with !LEGACY_DOTNET |
| src/SharpCompress/Compressors/LZMA/LZipStream.cs | Replaces !NETFRAMEWORK&&!NETSTANDARD2_0 with !LEGACY_DOTNET |
| src/SharpCompress/Compressors/Deflate64/Deflate64Stream.cs | Replaces !NETFRAMEWORK&&!NETSTANDARD2_0 with !LEGACY_DOTNET |
| src/SharpCompress/Compressors/Deflate/ZlibStream.cs | Replaces !NETFRAMEWORK&&!NETSTANDARD2_0 with !LEGACY_DOTNET |
| src/SharpCompress/Compressors/Deflate/ZlibConstants.cs | Removes obsolete NETCF conditional compilation and updates comment |
| src/SharpCompress/Compressors/Deflate/ZlibBaseStream.cs | Replaces !NETFRAMEWORK&&!NETSTANDARD2_0 with !LEGACY_DOTNET |
| src/SharpCompress/Compressors/Deflate/GZipStream.cs | Replaces !NETFRAMEWORK&&!NETSTANDARD2_0 with !LEGACY_DOTNET |
| src/SharpCompress/Compressors/Deflate/DeflateStream.cs | Replaces !NETFRAMEWORK&&!NETSTANDARD2_0 with !LEGACY_DOTNET |
| src/SharpCompress/Compressors/BZip2/BZip2Stream.cs | Replaces !NETFRAMEWORK&&!NETSTANDARD2_0 with !LEGACY_DOTNET |
| src/SharpCompress/Common/Zip/WinzipAesEncryptionData.cs | Replaces NETFRAMEWORK||NETSTANDARD2_0 with LEGACY_DOTNET |
| src/SharpCompress/Common/Tar/TarReadOnlySubStream.cs | Replaces !NETFRAMEWORK&&!NETSTANDARD2_0 with !LEGACY_DOTNET |
| src/SharpCompress/Common/EntryStream.cs | Replaces !NETFRAMEWORK&&!NETSTANDARD2_0 with !LEGACY_DOTNET |
| src/SharpCompress/Archives/SevenZip/SevenZipArchive.cs | Replaces !NETFRAMEWORK&&!NETSTANDARD2_0 with !LEGACY_DOTNET |
| src/SharpCompress/Algorithms/Adler32.cs | Replaces !NETSTANDARD2_0&&!NETSTANDARD2_1&&!NETFRAMEWORK with !LEGACY_DOTNET |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
Contributor
Author
adamhathcock
approved these changes
Jan 15, 2026
This was referenced Feb 11, 2026
This was referenced Feb 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Consolidate compile flags for NETFRAMEWORK and NETSTANDARD
Summary of Changes
This PR consolidates scattered
NETFRAMEWORKandNETSTANDARD2_0compile flags into a single, clearerLEGACY_DOTNETconstant.What Changed
Added
LEGACY_DOTNETcompile constant in SharpCompress.csprojnet48andnetstandard20targetsReplaced 41 occurrences across 25 files:
#if !NETFRAMEWORK && !NETSTANDARD2_0→#if !LEGACY_DOTNET#if NETFRAMEWORK || NETSTANDARD2_0→#if LEGACY_DOTNET#if !NETSTANDARD2_0 && !NETSTANDARD2_1 && !NETFRAMEWORK→#if !LEGACY_DOTNET#if NETFRAMEWORK || NETSTANDARD→#if LEGACY_DOTNET#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER→#if !LEGACY_DOTNETAdditional simplifications:
NETCF(NET Compact Framework) flag - not a supported targetNET60_OR_GREATER→NET6_0_OR_GREATERNET6_0_OR_GREATER→NET8_0_OR_GREATER(5 occurrences in 3 files)Benefits
LEGACY_DOTNETcommunicates purpose better than framework checksNET8_0_OR_GREATERaligns with actual project targets (net8.0, net10.0)Verification ✅
LEGACY_DOTNET)Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.