Search code examples
visual-studiomauivisual-studio-installer

I installed MAUI on VS but I can't find NuGet packages in the MAUI project


I installed MAUI with Visual Studio Installer (I ticked the ".NET Multi-plateform App UI development").

Then when i create a MAUI project it creates well but all the references of MAUI are missing. The error is Error CS0234 Type or namespace name 'Maui' does not exist in the 'Microsoft' namespace (are you missing an assembly reference?).

Indeed when I check the installed NuGet packages, they are not here (like if they are not installed).

How can I install MAUI NuGets packages to have them in my project?


Solution

  • I have already had the same problem. The cause of the problem was that Visual Studio Installer was installing the files in C:\Program Files while Visual Studio was trying to find the SDKs in C:\Program Files (x86). I had this behaviour because in my Path (environment variable) I had the paths C:\Program Files (x86)\dotnet AND C:\Program Files (x86)\dotnet.

    If this is the case for you, delete C:\Program Files (x86)\dotnet from your Path, reboot your PC, and restart Visual Studio. It should take the correct configuration.