Skip to content

Enable compression in singlefile - #16838

Merged
VSadov merged 12 commits into
dotnet:mainfrom
VSadov:compression
Apr 15, 2021
Merged

VSadov merged 12 commits into
dotnet:mainfrom
VSadov:compression

Conversation

@VSadov

@VSadov VSadov commented Apr 11, 2021 •

Copy link
Copy Markdown
Member
  • enable bundle compression by default for 6.0+
  • add an msbuild property
  • add tests

@ghost

ghost commented Apr 11, 2021

Copy link
Copy Markdown

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.

@VSadov
VSadov force-pushed the compression branch 2 times, most recently from 71385a7 to 7c03052 Compare April 13, 2021 19:03
@VSadov
VSadov marked this pull request as ready for review April 14, 2021 00:53
@VSadov
VSadov requested review from sbomer and vitek-karas April 14, 2021 00:53
@VSadov
VSadov marked this pull request as draft April 14, 2021 15:17
IsExe = true,
};

testProject.AdditionalProperties.Add("EnableCompressionInSingleFile", "true");

Copy link
Copy Markdown
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
Copy Markdown
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!

@VSadov VSadov Apr 14, 2021 •

Copy link
Copy Markdown
Member Author

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
Copy Markdown
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
Copy Markdown
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.

@VSadov VSadov Apr 14, 2021 •

Copy link
Copy Markdown
Member Author

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