I want to use NativeAOT with MonoGame.

Hi,
I am interested in NativeAOT after reading this article.

nativeAOT/CoreRT output?

Using the article as a reference, I tried to do native publish with .NET 6.0 using the current MonoGame Version 3.8.1.303 and VS2022, but the native binaries do not build.
Microsoft.DotNet.ILCompiler version is 7.0.0 and it references rd.xml from the project.
It did not work in an empty DesktopGL project, nor in the following repository

Is native publish possible with the current MonoGame version?

Hi,

Unfortunately, we did not get any help from anyone, but we were able to solve the problem on our own.
Finding the following web page was the solution. Thank you very much.

I have published a sample project and documentation on GitHub, and I would be happy to help anyone who has trouble with something similar.

Interesting. I’ve been interested in NativeAOT for potential performance benefits, but it’s incompatible with DirectX builds due to the use of Windows Forms.

1 Like

Thanks for reading.
Yes, It is unfortunate that DirectX builds cannot work with NativeAOT at this time. I hope and pray that future versions of .NET.

Pray for MG to stop using winforms in DirectX project, that’s way better as it is causing more issues than just AoT.

1 Like