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
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.
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:
This seems to be described here:
You also mention
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.
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 likeC:UsersOneDrive reposmy-projectmy-project
and then probably you can rebuild the project successfully.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.