forked from dotnet/macios
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[docs] Document NativeAOT support. Fixes dotnet#18585.
Fixes dotnet#18585.
- Loading branch information
1 parent
42ea483
commit 73e3c0f
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# NativeAOT | ||
|
||
We've added *experimental* support for using [NativeAOT][1] when publishing iOS, | ||
tvOS, Mac Catalyst and macOS apps in .NET 8. | ||
|
||
NativeAOT may produce smaller and/or faster apps - or it may not. It's very | ||
important test and profile to determine the results of enabling NativeAOT. | ||
|
||
NativeAOT is enabled by setting the `PublishAot` property to `true` in the project file: | ||
|
||
```xml | ||
<PropertyGroup> | ||
<PublishAot>true</PublishAot> | ||
</PropertyGroup> | ||
``` | ||
|
||
## Notes | ||
|
||
NativeAOT is only used when publishing (`dotnet publish`). In particular | ||
`dotnet build -t:Publish` is _not_ equivalent to `dotnet publish`, only | ||
`dotnet publish` will enable NativeAOT. | ||
|
||
**Unsupported** workaround: set the `_IsPublishing` property to `true` to make | ||
`dotnet build` think it's `dotnet publish`: | ||
|
||
```xml | ||
<PropertyGroup> | ||
<PublishAot>true</PublishAot> | ||
<_IsPublishing>true</_IsPublishing> | ||
</PropertyGroup> | ||
``` | ||
|
||
This can be useful to install and run apps with `NativeAOT` from the IDE, | ||
because it's not possible to use `dotnet publish` when running from the IDE. | ||
|
||
Note that NativeAOT does not support managed debugging. | ||
|
||
There's no interpreter when using NativeAOT, and as such the `UseInterpreter` | ||
and `MtouchInterpreter` properties have no effect. | ||
|
||
NativeAOT requires trimming, and `MAUI` isn't trimmer-safe, and thus | ||
unfortunately `MAUI` projects don't typically work with NativeAOT (we hope to | ||
rectify this situation for .NET 9). | ||
|
||
There are no known issues specific to our platforms with NativeAOT; but the | ||
[limitations][2] are exactly the same as for other platforms. | ||
|
||
[1]: https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot | ||
[2]: https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot/?tabs=net8plus%2Cwindows#limitations-of-native-aot-deployment |