-
Notifications
You must be signed in to change notification settings - Fork 7.1k
CmdPal: Don't trim the template proj in debug builds #39463
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
Conversation
I noticed the same, but decided to keep it. How "safe" is to trim only when compiled in release mode? |
This is vaguely inspired by this block out of the WinAppSdk project templates: <!-- Publish Properties -->
<PropertyGroup>
<PublishReadyToRun Condition="'$(Configuration)' == 'Debug'">False</PublishReadyToRun>
<PublishReadyToRun Condition="'$(Configuration)' != 'Debug'">True</PublishReadyToRun>
<PublishTrimmed Condition="'$(Configuration)' == 'Debug'">False</PublishTrimmed>
<PublishTrimmed Condition="'$(Configuration)' != 'Debug'">True</PublishTrimmed>
</PropertyGroup> I assumed setting <IsAotCompatible>true</IsAotCompatible> would leave things checked for being AoT (including trim) safe, but I'm clearly off my rocker. https://learn.microsoft.com/en-us/dotnet/core/deploying/trimming/prepare-libraries-for-trimming Looks like we want <PropertyGroup Condition="'$(Configuration)'=='Debug'">
<IsAotCompatible>false</IsAotCompatible>
<PublishTrimmed>false</PublishTrimmed>
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
<EnableSingleFileAnalyzer>true</EnableSingleFileAnalyzer>
<EnableAotAnalyzer>true</EnableAotAnalyzer>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'!='Debug'">
<PublishTrimmed>true</PublishTrimmed>
<IsAotCompatible>true</IsAotCompatible>
</PropertyGroup> i think? |
<CsWinRTAotOptimizerEnabled>true</CsWinRTAotOptimizerEnabled> | ||
<CsWinRTAotWarningLevel>2</CsWinRTAotWarningLevel> | ||
<!-- Suppress DynamicallyAccessedMemberTypes.PublicParameterlessConstructor in fallback code path of Windows SDK projection --> | ||
<WarningsNotAsErrors>IL2081</WarningsNotAsErrors> | ||
<WarningsNotAsErrors>IL2081;$(WarningsNotAsErrors)</WarningsNotAsErrors> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yay
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make the template ZIP something that's produced by the build system instead, later?
I would very much like that. |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
Squashed commit of the following: commit 3fb7ebe Author: Mike Griese <migrie@microsoft.com> Date: Thu May 15 16:38:17 2025 -0500 update template commit 167266a Author: Mike Griese <migrie@microsoft.com> Date: Thu May 15 16:37:46 2025 -0500 More correct commit fa672c6 Author: Mike Griese <migrie@microsoft.com> Date: Thu May 15 10:23:31 2025 -0500 add template zip commit 97205ea Author: Mike Griese <migrie@microsoft.com> Date: Thu May 15 10:22:51 2025 -0500 CmdPal: Don't trim in debug for template
this good to go? |
This saves a LOT of compilation time