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

Enable compression in singlefile #16838

Merged
merged 12 commits into from
Apr 15, 2021
Merged

Enable compression in singlefile #16838

merged 12 commits into from
Apr 15, 2021

Conversation

VSadov
Copy link
Member

@VSadov VSadov commented Apr 11, 2021

  • enable bundle compression by default for 6.0+
  • add an msbuild property
  • add tests

@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

IsExe = true,
};

testProject.AdditionalProperties.Add("EnableCompressionInSingleFile", "true");
Copy link
Member

Choose a reason for hiding this comment

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

You might have to explicitly set SelfContained to false since it defaults to true when there is a RuntimeIdentifier. I think you can also get rid of the exilicit SelfContained=true in the other tests.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, I see. I thought it is the opposite and it is not SelfContained unless explicitly specified. Thanks!

Copy link
Member Author

@VSadov VSadov Apr 14, 2021

Choose a reason for hiding this comment

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

@sbomer - do you know if there is an easy way to include a native lib dependency in these tests? I think the compression tests are failing because there is nothing in the bundle that we can compress.

We do not compress managed assemblies yet. We had a bug that would cause all native libraries be included as dependencies and tests were passing (with IncludeAllContent) , but I think the fix for that has merged to SDK yesterday. Since all we have in the bundle is managed assemblies, we have nothing to compress thus the size of the app is unaffected by the compression setting.

Copy link
Member

Choose a reason for hiding this comment

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

Not sure if there's a better way, but I found this test which adds a packagereference to sqlite and checks that native dependencies are included: https://github.com/dotnet/sdk/blob/main/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToCopyLocalDependencies.cs#L64

Copy link
Member

Choose a reason for hiding this comment

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

This is not just tests - the only "truly supported" way to include native libraries (as in it works in all configs) is through nuget package reference. So the sqllite is as good as any for that purpose.

Copy link
Member Author

@VSadov VSadov Apr 14, 2021

Choose a reason for hiding this comment

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

I will try sqllite. Thanks.
It is point-in-time problem though. Once we compress managed assemblies, this will not be an issue, so if sqllite does not work I can also wait for that change that adds support for managed.

@VSadov VSadov marked this pull request as ready for review April 14, 2021 21:00
@VSadov VSadov added the auto-merge Automatically merge PR once CI passes. label Apr 15, 2021
@VSadov VSadov removed the auto-merge Automatically merge PR once CI passes. label Apr 15, 2021
@VSadov VSadov merged commit 35dd773 into dotnet:main Apr 15, 2021
@VSadov VSadov deleted the compression branch April 15, 2021 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants