In .NET 6 RC1, you can now use a single project for all the MAUI target platforms. This means you no longer need an external WinUI project. However, this is not currently enabled by default, there are some configuration steps needed.
This is expected to be fixed in future releases of Visual Studio 2022 and .NET 6.
The first thing you need to do is make sure you have the prerequisite tooling installed, let's cover those quickly.
When installing Visual Studio 2022, make sure the .NET MAUI tools are selected underneath the optional section.
Visit the official blog post on the topic Update on .NET Multi-platform App UI .NET MAUI and carefully read the instructions.
Next, you need to get something that doesn't come with Visual Studio yet. Download and install the Single Project MSIX Packaging Tools VSExtension to Visual Studio 2022.
Let's start with a brand new .NET MAUI project (Visual Studio > File > New project > select .NET MAUI App).
At this point, you should have a MAUI project with
Windows listed under the Platforms folder. However, the Windows Platform doesn't have a TFM enabled so there's no way to build and deploy a Windows app.
Take the following steps to fix this.
To enable the Windows platform, you'll need to manually edit the .csproj file and uncomment the following line:
Make sure you save the csproj file immediately and let the project reload itself. After it is done reloading, you should now see a
net6.0-windows10.0.19041 TFM in the dependencies list:
Now that you have a Windows platform in the project, we need to configure Visual Studio to Deploy. Expand the target platform and change to Windows Machine and change the Framework to
Now, you can build and deploy the WinUI project to the local PC: