2

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?

  • "maui-check" might help you to make sure your MAUI install is correct. More here https://github.com/Redth/dotnet-maui-check Else I would close the solution, delete bin/obj.. open the solution, restore packages, and then would try to build.. – N Subedi Mar 28 '23 at 13:59
  • MAUI is not deployed as a nuget package – Jason Mar 28 '23 at 14:05
  • @Jason Ok but i do not have access to the namespace : "Microsoft.Maui" – Romain Dos Santos Mar 28 '23 at 14:07
  • @NSubedi thanks for your help but it's not the csproj that not has MAUI it's all my MAUI projects... How can i restore global packages? – Romain Dos Santos Mar 28 '23 at 14:12
  • You can check whether the SDK for Maui is installed during installation. Have you tried reinstalling VS to see if the problem still occurs? You can open VS and click the avatar in the upper right corner -> Report a problem. – Zack Mar 29 '23 at 05:23

1 Answers1

3

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.

AoooR
  • 370
  • 1
  • 9