Publish Failed when Native AOT publish enabled in .Net 8 Visual Studio 2022

569 views Asked by At

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.

enter image description here

enter image description here

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.

1

There are 1 answers

2
Vivek Nuna On BEST ANSWER

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.

enter image description here