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

Use better AOT defaults in Web SDK #29984

Merged
merged 4 commits into from
Jan 19, 2023
Merged

Use better AOT defaults in Web SDK #29984

merged 4 commits into from
Jan 19, 2023

Conversation

halter73
Copy link
Member

@halter73 halter73 commented Jan 18, 2023

This PR provides better defaults for the TrimMode and PublishIISAssets properties when the PublishAot property is set to true.

Once this is merged, we should be able to follow up by removing these properties from the AOT version of the new "api" project template.

Fixes #30059
Fixes #29896

Copy link
Member

@JamesNK JamesNK left a comment

Choose a reason for hiding this comment

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

LGTM

However, I'm not an msbuild/SDK person. I recommend a second opinion.

Copy link
Member

@eerhardt eerhardt left a comment

Choose a reason for hiding this comment

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

Can we write a test or two that ensures these are set correctly?

halter73 and others added 2 commits January 18, 2023 09:49
Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
@halter73 halter73 enabled auto-merge January 18, 2023 23:13
@halter73 halter73 disabled auto-merge January 18, 2023 23:13

var buildProperties = testProject.GetPropertyValues(testAsset.TestRoot, targetFramework);
buildProperties["PublishTrimmed"].Should().Be("true");
buildProperties["TrimMode"].Should().Be("");
Copy link
Member Author

Choose a reason for hiding this comment

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

This verifies we don't set TrimMode to "partial" like we do in the PublishTrimmed-only case. Does anyone know of a better way to verify we get "full" trimming?

@halter73 halter73 requested a review from brunolins16 January 18, 2023 23:20
@halter73 halter73 merged commit ec99fc3 into main Jan 19, 2023
@halter73 halter73 deleted the halter73/46084 branch January 19, 2023 04:17
@@ -87,7 +88,8 @@ Copyright (C) Microsoft Corporation. All rights reserved.
<EFSQLScriptsFolderName Condition="$(EFSQLScriptsFolderName) == ''">EFSQLScripts</EFSQLScriptsFolderName>

<!-- If TrimMode has not already been set, default to partial trimming, as AspNet is not currently fully trim-compatible -->
<TrimMode Condition="'$(PublishTrimmed)' == 'true' and '$(TrimMode)' == ''">partial</TrimMode>
<!-- We allow the full trimming default with PublishAot enabled, because the parts that are not trim-compatible are not aot-compatible either -->
<TrimMode Condition="'$(TrimMode)' == '' and '$(PublishTrimmed)' == 'true' and '$(PublishAot)' != 'true'">partial</TrimMode>
Copy link
Member

Choose a reason for hiding this comment

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

We should think about defaulting to full with PublishTrimmed true as well

cc @DamianEdwards @eerhardt

Copy link
Member

Choose a reason for hiding this comment

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

yeah this came up in the original issue and discussion but it seems a bit premature right now given the state of trimmability across all of ASP.NET Core. Not ruling it out for .NET 8 though if we think we get far enough to make it the better default.

Copy link
Member

Choose a reason for hiding this comment

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

Can we track it in an issue and punt it to the next release if we decide?

Copy link
Member Author

Choose a reason for hiding this comment

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

I reopened #30059 and put it in the Goldilocks project for tracking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants