Hello,
I can reproduce the same issue as you, then I found this GitHub: Build Windows target using dotnet build instead of msbuild.exe, so it looks like that currnetly using dotnet build to build a .NET MAUI app for Windows doesn't work with the current previews of .NET MAUI, but the good news is that we can use the MSBuild to build the MAUI application.
And I have tried it, it works great on my side. In order to use MSBuild without installing Visual Studio, first you can click this link to download Build Tools for Visual Studio 2022.
In Visual Studio 2022, the tool is installed in: C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin
, you could set the environment variable for it.
Then, you could run the command line to build your MAUI project.
msbuild -r -p:Configuration=Release -p:RestorePackages=false -p:TargetFramework=net6.0-windows10.0.19041
MAUI is still in preview testing, and we will fix these issues as soon as possible.:)
Thanks for your feedback.
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.