1

I have made a WPF application, I would like to have the final app be shipped as a single executable using AOT compilation so that it cannot be decompiled easily. I have tried using <PublishAot>true</PublishAot>, but it didn't publish as an AOT project for some reason. I also couldn't find a tutorial anywhere, is it even possible? If so, can I have a step-by-step guide on how to do this?

Edit: I am using .NET framework, but I can switch to .NET core if need be. I don't really care about the limitations, I just need to know if and how it is possible to AOT publish a WPF program.

bferns
  • 21
  • 2
  • WPF on .NET Framework? Or .NET Core? – Lex Li Oct 21 '22 at 22:44
  • 2
    Limitations are [well documented](https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot/#limitations-of-native-aot-deployment), *Should be targeted for console type applications*. – Hans Passant Oct 22 '22 at 02:16
  • @LexLi .NET Framework – bferns Oct 22 '22 at 15:12
  • @HansPassant yes, but is it possible to do this with a WPF program even if it is not recommended? – bferns Oct 22 '22 at 15:15
  • .NET Framework is out of hope, as the AOT tooling was not designed for it. Don’t waste your time there. – Lex Li Oct 22 '22 at 15:32
  • @LexLi but if it was in .NET core, how would it be possible? – bferns Oct 22 '22 at 16:44
  • AOT is there on .NET Core, but "shipped as a single executable" might not work as the way you wanted. You'd better try it yourself and see how it goes. – Lex Li Oct 22 '22 at 22:20
  • See [this answer](https://stackoverflow.com/a/71224635/7252182) for instructions on how to create a single-file WPF app using .NET 6. – mm8 Oct 23 '22 at 17:59

0 Answers0