1

I'm creating a MAUI application targeting iOS and Android. I have been using Visual Studio 2022 for Mac version 17.3. That version doesn't really support archiving the app, so I installed version 17.4 preview 2.1. When I try to compile my app I get the following error:

Unable to find Microsoft.NET.Runtime.MonoAOTCompiler.Task

I found a post that indicated I should run the command: dotnet add package Microsoft.NET.Runtime.MonoAOTCompiler.Task --version 7.0.0-rc.2.22472.3

When I run that command in terminal I get the error: error: Value cannot be null. (Parameter 'version')

Everything I have found indicated that the problem should have been fixed in Preview 2.1 of Visual Studio 2022 for Mac, but it is still occurring.

Can anyone help me resolve this? I need to publish my app to the stores and can't get it to compile in release mode or create the archive because of that.

1 Answers1

0

You need to add the package to your project.

First, you should right click your project name and choose the Manage Nuget packages button.

enter image description here

Second, you can search the package Microsoft.NET.Runtime.MonoAOTCompiler.Task and install it. enter image description here

Then you successfully add the package to your project.

Guangyu Bai - MSFT
  • 2,555
  • 1
  • 2
  • 8
  • Attempting to add that package fails. The following error occurs 3 times, followed by the message that Package Restore failed Rolling back package changes for . Restoring packages for .NETCoreApp,Version=v6.0... The local source '/Users/davidrutter/.nuget/NuGet/Microsoft.NET.Runtime.MonoAOTCompiler.Task' doesn't exist. – David Rutter Oct 14 '22 at 18:25
  • The error with the MonoAOTCompiler.Task only shows up in Release configuration. – David Rutter Oct 14 '22 at 20:31
  • You can do the following steps: 1. Open VS Tools 2. Choose Options 3. Nuget Package Manager 4. General 5. Clear All Nuget Cache(s). – Guangyu Bai - MSFT Oct 17 '22 at 02:30
  • Clearing the Nuget Cache fixed the problem. Thank you. – David Rutter Oct 25 '22 at 16:08