skip to Main Content

I wrote a Xamarin App and I understand that Xamarin is no longer supported. So, i am starting to rewrite/rebuild it under MAUI.
I created a blank MAUI app in Visual Studio 2022. and I am getting these errors before I even write a line of code:

Error XA1018 Specified AndroidManifest file does not exist: C:UsersOneDrive reposmy-projectmy-projectAndroidManifest.xml.
Error NU1012 Platform version is not present for one or more target frameworks, even though they have specified a platform: net8.0-ios, net8.0-maccatalyst

The first error occurs in line 613 of Xamarin.Android.Common.targets. Why is there a reference to Xamarin?

I noticed that the 4 dependencies net8.0-android34.0, net8.0-ios, net8.0-maccatalyst and net8.0-windows10.0.22621.0 all have yellow triangles beside the names in the dependencies folder.

I updated the Microsoft.Maui.Controls and Microsoft.Maui.Controls.Compatibilty NuGets but the package restores failed.

I repaired my installation of Visual Studio 2022 and tried to recreate the blank MAUI app and i still get the same errors.

2

Answers


  1. While it shouldn’t matter to you, the default template is not created with errors. The thing you seem to describe here is a setup on your machine that is not correct and therefore the default template (or any .NET MAUI project) won’t build right now.

    Why is there a reference to Xamarin?

    As you can imagine the transition from Xamarin to .NET MAUI is a big one. While we did everything we could to remove the Xamarin name everywhere, we’re not 100% there yet.

    While we made the switch from Xamarin.Forms to .NET MAUI, the underlaying layer is not completely there yet. Xamarin.Android and Xamarin.iOS are still living in their "old" repositories and have some renaming to do.

    There probably will be some Xamarin in some areas for a little while.

    As for the actual error:

    Error NU1012 Platform version is not present for one or more target frameworks, even though they have specified a platform: net8.0-ios, net8.0-maccatalyst

    This seems to be described here:

    This problem typically results from having an x86 and x64 SDK installed, and the x86 version is being used. Visual Studio and .NET MAUI require the x64 .NET SDK. If your operating system has a system-wide PATH variable that is resolving the x86 SDK first, you need to fix that by either removing the x86 .NET SDK from the PATH variable, or promoting the x64 .NET SDK so that it resolves first. For more information on troubleshooting x86 vs x64 SDK resolution, see Install .NET on Windows – Troubleshooting.

    You also mention

    I updated the Microsoft.Maui.Controls and Microsoft.Maui.Controls.Compatibilty NuGets but the package restores failed

    This is curious though. What versions did you update to and what is the error you get?

    Hopefully this will help resolve what you’re seeing.

    Login or Signup to reply.
  2. Error XA1018 Specified AndroidManifest file does not exist:
    C:UsersOneDrive reposmy-projectmy-projectAndroidManifest.xml.

    For the error above, I have met this before. To fix it, you can copy the AndroidManifest.xml file from the AndroidPlatforms subfolder to the project’s root folder like C:UsersOneDrive reposmy-projectmy-project and then probably you can rebuild the project successfully.

    Error NU1012 Platform version is not present for one or more target >frameworks, even though they have specified a platform: net8.0-ios, net8.0->maccatalyst

    As for this error, you can firstly close the VS and then delete files in C:Program Filesdotnetmetadataworkloads. Run below in command line like below. Note that this is related with Error NU1012 when creating a .Net Maui app in Visual Studio 2022.

     dotnet workload install maui 
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search