2 ms·
Self-contained/single-file mode is compatible with trimming and benefits from the work done to improve AOT story. As AOT binaries get smaller and ILLink's analy
by neonsunset 2y ago
Self-contained/single-file mode is compatible with trimming and benefits from the work done to improve AOT story. As AOT binaries get smaller and ILLink's analysis gets smarter, the single-file trimmed binaries will see a part of such improvements.
The issue is that many GUI frameworks are not AOT-incompatible per se but rather trim-incompatible as they rely on reflection that is done in a way that is totally opaque to ILLink save for rooting everything.
You can try the following publish option anyway, and in many instances it "just works" (assuming .NET 8 SDK):
dotnet publish -o out -p:PublishSingleFile=true -p:PublishTrimmed=true
Note: trimming was introduced in .NET 6, and NativeAOT was initially introduced in 7, so it had seen quite a bit of work to mature and improve by the time 8 shipped.
- pjmlp 2y agoIf only UWP had a AOT compilation story for .NET code that could be re-used for WinUI 3.0.... And then there is the whole C# / C++ interop between CsWinRT and C++/WinRT.