Search code examples
c#.netwinforms.net-corenative

How to compile a .NET winform to native code?


i have 1 winform written in .net 7.0 is there any way to compile application to native code.

I have read many articles and tried many ways but it seems they do not support winform.

If possible, can you give me a detailed example.


Solution

  • .NET 7 supports Native AOT only for console apps. From the docs:

    Native AOT is targeted towards console-type apps. Only a limited number of libraries are fully compatible with native AOT.

    There are some community efforts you can try - for example WinFormsComInterop

    See also: