Skip to content

tetherscript/WinUI-AOT-Samples

Repository files navigation

WinUI AOT Samples

Not sure if it's just me, but I couldn't find a coherent guide on how to publish AOT for packaged AND unpackaged WinUI c# apps. Even ChatGPT said it could not be done.

But various posts hinted that it was being done. Then this post dotnet/runtime#109452 gave me a sample app and clues to figure it out.

So now i can compile packaged and unpackaged AOT code, so it can't be decompiled back to c#.

Victory. Sweet victory.

Included is the AOTCombined project that allows you to create both packaged AND unpackaged installers.

Here's the executable of the AOTSample project, installed via it's .msix. image

And here's the executable of the AOTSampleUnpackged prject, just waiting to be included in an installer (Inno, anyone?) image

This project uses:

  • .Net 8
  • c#
  • WinUI
  • WinAppSDK 1.7

I hope to add some additional projects that show what kind of code works and doesn't work when compiling AOT. There's a bunch of gotcha's, noted here, although they really don't talk about WinUI specifically:

https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot/?tabs=windows%2Cnet8

Detailed instructions are included in the

/Documents/Notes.txt in each project.

View the Wiki for more info.

About

AOT for WinUI publishing for both packaged and unpackaged projects

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages