Issues on MAUI Project upgraded from Xamarin Forms Project

Sreejith Sreenivasan 1,001 Reputation points
2023-08-04T10:07:49.9166667+00:00

I have converted a Xamarin project to MAUI project using Upgrade Assistant as per this blog. First I upgraded solution, then I upgraded the android and ios projects. After that I build my solution but I get the below errors.

Severity Code Description Project File Line Suppression State

Error NETSDK1047 Assets file 'C:\Users\SREEJITH\source\repos\MAUIDemo\MAUIDemo\MAUIDemo.iOS\obj\project.assets.json' doesn't have a target for 'net6.0-ios/ios-arm64'. Ensure that restore has run and that you have included 'net6.0-ios' in the TargetFrameworks for your project. You may also need to include 'ios-arm64' in your project's RuntimeIdentifiers. MAUIDemo.iOS C:\Program Files\dotnet\sdk\7.0.306\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets 266

Error CS0234 The type or namespace name 'Forms' does not exist in the namespace 'Xamarin' (are you missing an assembly reference?) MAUIDemo.Android (net6.0-android) C:\Users\SREEJITH\source\repos\MAUIDemo\MAUIDemo\MAUIDemo.Android\MainActivity.cs 11 Active

Error CS0234 The type or namespace name 'Content' does not exist in the namespace 'MAUIDemo.Android' (are you missing an assembly reference?) MAUIDemo.Android (net6.0-android) C:\Users\SREEJITH\source\repos\MAUIDemo\MAUIDemo\MAUIDemo.Android\MainActivity.cs 21 Active

Error CS0234 The type or namespace name 'Essentials' does not exist in the namespace 'Xamarin' (are you missing an assembly reference?) MAUIDemo.Android (net6.0-android) C:\Users\SREEJITH\source\repos\MAUIDemo\MAUIDemo\MAUIDemo.Android\MainActivity.cs 17 Active

Error CS0234 The type or namespace name 'Forms' does not exist in the namespace 'Xamarin' (are you missing an assembly reference?) MAUIDemo.Android (net6.0-android) C:\Users\SREEJITH\source\repos\MAUIDemo\MAUIDemo\MAUIDemo.Android\MainActivity.cs 18 Active

Error CS0103 The name 'LoadApplication' does not exist in the current context MAUIDemo.Android (net6.0-android) C:\Users\SREEJITH\source\repos\MAUIDemo\MAUIDemo\MAUIDemo.Android\MainActivity.cs 19 Active

Error CS0234 The type or namespace name 'Essentials' does not exist in the namespace 'Xamarin' (are you missing an assembly reference?) MAUIDemo.Android (net6.0-android) C:\Users\SREEJITH\source\repos\MAUIDemo\MAUIDemo\MAUIDemo.Android\MainActivity.cs 23 Active

Screenshot:

User's image

User's image

I have a few questions related to this:

  1. I upgraded the solution, android and iOS projects. Is solution upgrade is enough or do we need to upgrade the android and iOS projects?
  2. When I create a new MAUI project, I found there is a Platforms folder and on that I found Android and iOS sub folders. But when upgrade no such folders are created on my side, should I create it manually?
  3. Below is the project structure of a MAUI project created. Like that do I need to create all the files and folders?

User's image

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

Accepted answer
  1. Anonymous
    2023-08-14T08:15:32.46+00:00

    Hello,

    But I can't run the app on my device bacause the device is not listing in debug section.

    But the device is available for all the other projects. Anything else to do to fix this issue?

    I added the <SingleProject>true</SingleProject> property into my Android project's .csproj file under the first/main property group, closed VS, deleted Bin, Obj, .vs folders.

    After starting VS again , I rebuilt and VS allowed me to debug on selected .net targets like a single project Maui solution.

    Then, you will get the AAPT error cannot find the mipmap/icon, please set all of files' build action to AndroidResource in the Resource folder.

    Then you can run your maui project.

    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.

    1 person 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.