Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When targeting .NET Framework, the SDK references System.IO.Compression.FileSystem, but not System.IO.Compression #40691

Open
terrajobst opened this issue May 5, 2024 · 0 comments
Assignees
Labels
Area-NetSDK untriaged Request triage from a team member

Comments

@terrajobst
Copy link
Member

terrajobst commented May 5, 2024

I don't know why we did this, but it doesn't really make sense:

System.IO.Compression.FileSystem defines the ZipFile class which has convenience methods for ZipArchive that allow using paths instead of Stream. We did this originally for Windows 8 because you couldn't use paths in store apps. Since ZipArchive is defined in System.IO.Compression and is returned from various methods on ZipFile, users will usually get a compilation error:

The type 'ZipArchive' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.IO.Compression, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

Regardless of the comment here:

<!-- Framework assemblies introduced in .NET 4.5 -->
<_SDKImplicitReference Include="System.IO.Compression.FileSystem" Condition=" '$(_TargetFrameworkVersionWithoutV)' >= '4.5' "/>

it doesn't seem old-style (i.e. non-SDK style) projects add an assembly reference to System.IO.Compression.FileSystem.

Comparing what an old-style .NET Framework 4.7.2 project references it seems there are quite a few inconsistencies:

Assembly Referenced in old-style Referenced in SDK-style
Microsoft.CSharp Yes No
mscorlib Yes Yes
System Yes Yes
System.Core Yes Yes
System.Data Yes Yes
System.Data.DataSetExtensions Yes No
System.Drawing No Yes
System.IO.Compression.FileSystem No Yes
System.Net.Http Yes No
System.Numerics No Yes
System.Runtime.Serialization No Yes
System.Xml Yes Yes
System.Xml.Linq Yes Yes

At the minimum, we should add System.IO.Compression to make the references consistent but we might also want to add some of the missing ones, most notably System.Net.Http.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-NetSDK untriaged Request triage from a team member labels May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-NetSDK untriaged Request triage from a team member
Projects
None yet
Development

No branches or pull requests

2 participants