The type or namespace Maui does not exist in the namespace

DPlez 0 Reputation points
2025-10-28T06:09:03.3966667+00:00

I tried to update my Xamarin project to MAUI dotnet8 using the .NET Upgrade assistant CLI and it went very poorly. I've been getting this error no matter what I do.
User's image

I checked to see if dotnet 8 was listed.User's image

I tried to install the Maui workload and it told me that Maui was already installed. I opened my Visual Studio Community installer to check if I checked on MAUI and it is checked.

I tried using copilot to solve the issue but all it did was recommend me to do the same basic things I did dozens of times in the command line and even give me bogus nonsense like erasing the Maui libraries from the code despite many of my files being heavily dependent on INavigation!

I redid the CLI installation with dotnet9 and dotnet 10 at least 3 times each and I still get the same error. I redid the CLI for dotnet8 and I got the same issue. Most of them were side-by-side updates wherease one was an in-place upgrade done on a cloned repo. I still have the same issue every single time.

I re-installed dotnet8 and I STILL experience this problem.

My dependencies look like this
User's image
When accessing the Microsoft library, nearly every single sub-library including Maui has the orange triangle on it with the tag Not Available on it. What exactly am I doing wrong and how can I fix this? It's been going on like this for a week!

This error occurs exclusively for the common Xamarin files of MyApp that MyApp.Droid and MyApp.iOS utilize. Files exclusively under MyApp.Droid and/or MyApp.iOS do not exhibit this problem. I do not see this error whatsoever in those two libraries, it's exclusively for the common code xamarin library

How do I fix the error of the common library?

Developer technologies | Visual Studio | Debugging
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Varsha Dundigalla(INFOSYS LIMITED) 2,785 Reputation points Microsoft External Staff
    2025-10-28T13:01:05.7566667+00:00

    Thank you for sharing all the detailed information.

    I completely understand how frustrating this must be, especially after spending so much time reinstalling SDKs, updating workloads, and even trying Copilot suggestions. You’ve already done a thorough job ruling out environment-related issues, so it’s very likely that the problem lies in how your shared/common project was converted during the Xamarin to .NET MAUI migration.

    Even when MAUI and .NET 8 are installed correctly, the shared project sometimes keeps parts of the old Xamarin setup, which causes Visual Studio to show the “namespace Microsoft.Maui does not exist” error. This usually happens when the project is still treated as a Xamarin library instead of a MAUI-compatible class library.

    1. Check the project configuration – Open the shared project’s .csproj file and confirm it’s set up as a MAUI class library. It should target .NET 8 platforms (Android, iOS, or Windows), not Xamarin or .NET Standard.
    2. Review namespace references – Go through your shared code and make sure the old Xamarin namespaces (like Xamarin.Forms) have been replaced with their MAUI equivalents (Microsoft.Maui).
    3. Verify target frameworks – Make sure the shared project targets the same .NET 8 frameworks as your Android, iOS, and Windows projects.
    4. Check for leftover Xamarin packages – Remove any remaining Xamarin.Forms or Xamarin.Essentials references if they’re still present.
    5. Rebuild after updates – Once these are aligned, perform a full clean and rebuild so Visual Studio can reload the MAUI dependencies correctly.

    I’d recommend starting with the project configuration, as it’s the most common area that remains partially migrated after running the Upgrade Assistant.

    These steps address the subtle project-level issues that usually remain even after verifying workloads multiple times. Please try reviewing these areas.

    Please let us know if you require any further assistance, we’re happy to help.

    If you found this information useful, kindly mark this as "Accept Answer".


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.