I have created a console application targeting .NET 8 using Visual Studio 2022. I have checked the Enable native AOT publish option when creating the project. It gives the below error.
Error Text:
Publish has encountered an error. Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details.
A diagnostic log has been written to the following location: "C:\Users\MyName\AppData\Local\Temp\tmp227D.tmp"
This article only talk about CLI.
I am able to solve the issue by selecting the Target runtime to win-x64 in Profile Setting, It was Portable by default. We need to provide the specific runtime identifier.