Xamarin forms to MAUI migration issues

Sakshi Poojary 95 Reputation points
2023-08-16T15:14:22.05+00:00

I have tried to migrate my Xamarin Forms app to MAUI using .NET 7 using the upgrade assistant extension in visual studio. First I migrated the solution, then android and finally the iOS projects. (Is this workflow correct?)

After that I have deleted the bin and obj folders, clean the project and done Rebuild.

But I am getting below errors when rebuilding the project.

Severity Code Description Project File Line Suppression State Error NU1012 Platform version is not present for one or more target frameworks, even though they have specified a platform: net7.0-android MyProject.Android E:\My Projects\Xamarin.Net7\MyProject-app\MyProject\MyProject.Android\MyProject.Android.csproj 1

Severity Code Description Project File Line Suppression State Error NETSDK1139 The target platform identifier android was not recognized. MyProject C:\Program Files\dotnet\sdk\7.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets 113

Severity Code Description Project File Line Suppression State Error NETSDK1139 The target platform identifier ios was not recognized. MyProject C:\Program Files\dotnet\sdk\7.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets 113

I found a similar thread here for the first issue and found a similar thread here for the 2nd and 3rd issues. But I didn't get a clear picture of what fix need to do?

I also tried the migration with .NET 8 and getting same above errors. My project is already available on stores. So if we create a new MAUI project and move all the files into it, is it approve by the stores?

Developer technologies | .NET | Xamarin
Developer technologies | .NET | .NET MAUI
{count} votes

Accepted answer
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 50,126 Reputation points Microsoft External Staff
    2023-08-18T03:10:18.39+00:00

    Hello,

    After testing, xamarin.ios projects that cannot find the target framework after upgrading using the latest upgrade assistant will have the problem of not finding the target framework.

    So my doubt is before upgrading Do I need to Convert project to SDK style? I feel some of the issues are happening due to some kind of cache. Do I need to clear any kind of folders like bin and obj? Other than bin and obj, do I need to delete any other cache folders for the proper working of the application?

    You need to change the SDK style, and the issue is not caused by cache. Upgrade Assistant does not complete all the migration work, you need to refer to the following documents to complete the manual migration.

    Run .NET Upgrade Assistant for .NET MAUI to migrate your csproj to SDK Style, and perform well-known code migration (namespaces, name changes)

    Alternatively, you can refer to the following wiki to migrate the code in Xamairn to a newly created MAUI project.

    Best Regards,

    Alec Liu.


    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.


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.