Skip to content

Commit

Permalink
[windows] Release builds use $(PublishReadyToRun) by default (#9357)
Browse files Browse the repository at this point in the history
Context: https://docs.microsoft.com/dotnet/core/deploying/ready-to-run
Fixes: #9299

One of the biggest wins we see for MAUI startup on Windows is to
enable "Ready to Run", which seems to improve startup by as much as
50% in templates or sample apps with a reasonable increase in app size.

For example, the `dotnet new maui` template built for `win-x64`:

    45375824 PublishReadyToRun-false.msix
    59687908 PublishReadyToRun-true.msix

This setting is already used by the WindowsAppSdk templates via
publish profiles:

    Properties\PublishProfiles\win10-x64.pubxml
    Properties\PublishProfiles\win10-x86.pubxml
    Properties\PublishProfiles\win10-arm64.pubxml

These files are just MSBuild files, but they all contain:

    <PublishReadyToRun>true</PublishReadyToRun>

In .NET MAUI, I think we should just put this as a default in our
MSBuild targets, and customers get it by default for `Release` builds.
You can "opt out" of `PublishReadyToRun` by setting it to `false`.
  • Loading branch information
jonathanpeppers authored Aug 12, 2022
1 parent 1f1f690 commit 74ef5c8
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions .nuspec/Microsoft.Maui.Controls.SingleProject.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<WindowsAppSDKSelfContained Condition=" '$(WindowsAppSDKSelfContained)' == '' and '$(WindowsPackageType)' == 'None' and '$(OutputType)' == 'WinExe' ">true</WindowsAppSDKSelfContained>
<WindowsAppSdkBootstrapInitialize Condition=" '$(WindowsAppSdkBootstrapInitialize)' == '' and '$(EnableMsixTooling)' == 'true' and '$(OutputType)' != 'WinExe' ">false</WindowsAppSdkBootstrapInitialize>
<PublishAppXPackage Condition=" '$(PublishAppXPackage)' == '' and '$(EnableMsixTooling)' == 'true' and '$(WindowsPackageType)' == 'MSIX' ">true</PublishAppXPackage>
<PublishReadyToRun Condition=" '$(Configuration)' == 'Release' and '$(PublishReadyToRun)' == '' ">true</PublishReadyToRun>
<_SingleProjectRIDRequired Condition="'$(OutputType)' == 'WinExe'">true</_SingleProjectRIDRequired>
<_SingleProjectRIDSpecified Condition="'$(RuntimeIdentifier)' != '' or '$(RuntimeIdentifiers)' != ''">true</_SingleProjectRIDSpecified>
</PropertyGroup>
Expand Down

0 comments on commit 74ef5c8

Please sign in to comment.