Build fail for project in Android [.NET 8]

Alberto Fagni 20 Reputation points
2024-01-18T14:28:49.43+00:00

Good morning, I have a perfectly working MAUI project developed with .NET7 that I decided to migrate to .NET8. However, I am unable to publish in Release, while in Debug it works correctly. Good morning, I have a perfectly working MAUI project developed with .NET7 that I decided to migrate to .NET8. However, I am unable to publish in Release, while in Debug it works correctly. these are the errors I get. Any suggestions? Error Precompiling failed for C:\WorkingFolders\Kering-APEEvo\src\APEEvo.Mobile\APEEvo.Mobile\obj\Release\net8.0-android\android-arm64\aot-in\Microsoft.VisualBasic.Core.dll with exit code 1. Can not open image obj\Release\net8.0-android\android-arm64\aot-in\Microsoft.VisualBasic.Core.dll APEEvo.Mobile C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.52\targets\Microsoft.Android.Sdk.Aot.targets 109 Error Precompiling failed for C:\WorkingFolders\Kering-APEEvo\src\APEEvo.Mobile\APEEvo.Mobile\obj\Release\net8.0-android\android-arm64\aot-in\System.AppContext.dll with exit code 1. Can not open image obj\Release\net8.0-android\android-arm64\aot-in\System.AppContext.dll APEEvo.Mobile C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.52\targets\Microsoft.Android.Sdk.Aot.targets 109 Error Precompiling failed for C:\WorkingFolders\Kering-APEEvo\src\APEEvo.Mobile\APEEvo.Mobile\obj\Release\net8.0-android\android-arm64\aot-in\System.ComponentModel.Annotations.dll with exit code 1. Can not open image obj\Release\net8.0-android\android-arm64\aot-in\System.ComponentModel.Annotations.dll APEEvo.Mobile C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.52\targets\Microsoft.Android.Sdk.Aot.targets 109 Error Precompiling failed for C:\WorkingFolders\Kering-APEEvo\src\APEEvo.Mobile\APEEvo.Mobile\obj\Release\net8.0-android\android-arm\aot-in\Microsoft.VisualBasic.Core.dll with exit code 1. Can not open image obj\Release\net8.0-android\android-arm\aot-in\Microsoft.VisualBasic.Core.dll APEEvo.Mobile C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.52\targets\Microsoft.Android.Sdk.Aot.targets 109 Error Precompiling failed for C:\WorkingFolders\Kering-APEEvo\src\APEEvo.Mobile\APEEvo.Mobile\obj\Release\net8.0-android\android-x64\aot-in\Microsoft.VisualBasic.Core.dll with exit code 1. Can not open image obj\Release\net8.0-android\android-x64\aot-in\Microsoft.VisualBasic.Core.dll APEEvo.Mobile C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.52\targets\Microsoft.Android.Sdk.Aot.targets 109 Error Precompiling failed for C:\WorkingFolders\Kering-APEEvo\src\APEEvo.Mobile\APEEvo.Mobile\obj\Release\net8.0-android\android-x64\aot-in\System.AppContext.dll with exit code 1. Can not open image obj\Release\net8.0-android\android-x64\aot-in\System.AppContext.dll APEEvo.Mobile C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.52\targets\Microsoft.Android.Sdk.Aot.targets 109 Error Precompiling failed for C:\WorkingFolders\Kering-APEEvo\src\APEEvo.Mobile\APEEvo.Mobile\obj\Release\net8.0-android\android-x64\aot-in\System.ComponentModel.Annotations.dll with exit code 1. Can not open image obj\Release\net8.0-android\android-x64\aot-in\System.ComponentModel.Annotations.dll APEEvo.Mobile C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.52\targets\Microsoft.Android.Sdk.Aot.targets 109 Error Precompiling failed for C:\WorkingFolders\Kering-APEEvo\src\APEEvo.Mobile\APEEvo.Mobile\obj\Release\net8.0-android\android-x86\aot-in\Microsoft.VisualBasic.Core.dll with exit code 1. Can not open image obj\Release\net8.0-android\android-x86\aot-in\Microsoft.VisualBasic.Core.dll APEEvo.Mobile C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.52\targets\Microsoft.Android.Sdk.Aot.targets 109 Error Precompiling failed for C:\WorkingFolders\Kering-APEEvo\src\APEEvo.Mobile\APEEvo.Mobile\obj\Release\net8.0-android\android-x86\aot-in\System.AppContext.dll with exit code 1. Can not open image obj\Release\net8.0-android\android-x86\aot-in\System.AppContext.dll APEEvo.Mobile C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.52\targets\Microsoft.Android.Sdk.Aot.targets 109 Error Precompiling failed for C:\WorkingFolders\Kering-APEEvo\src\APEEvo.Mobile\APEEvo.Mobile\obj\Release\net8.0-android\android-x86\aot-in\System.ComponentModel.Annotations.dll with exit code 1. Can not open image obj\Release\net8.0-android\android-x86\aot-in\System.ComponentModel.Annotations.dll APEEvo.Mobile C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.52\targets\Microsoft.Android.Sdk.Aot.targets 109

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,449 questions
0 comments No comments
{count} votes

Accepted answer
  1. Leon Lu (Shanghai Wicresoft Co,.Ltd.) 74,801 Reputation points Microsoft Vendor
    2024-01-19T02:32:46.11+00:00

    Hello, Based on your error, this issue is related to the AOT. please right click your project, choose property. Open the Android selection->choose Options-> Find the AOT-> Un-select the Release & net8.0-android. After that, please close your VS and open your project folder, delete the bin and obj folder and open your project with VS, rebuild your project and release it. Best Regards, Leon Lu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    3 people found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.