Sometimes you just want to send the binaries to someone and not bother with a whole MSIX installer. In this post I will show you how to create a so-called unpackaged Windows app with .NET MAUI.
Regular WinUI/Windows .NET MAUI App Distribution with MSIX
Typically you want to use an MSIX to distribute your Windows app. By using an MSIX the prerequisites the user has to have installed will be checked and installed automatically and you will have a cool looking installer. Also, if you want to publish to the Microsoft Store, you will need to have an MSIX file.
If you’re not going to publish to the store, you also need a (self-signed) certificate and things suddenly get a bit complicated. No worries! If creating an MSIX is what you need, watch the video below and I will teach you exactly how to do it.
Unpackaged .NET MAUI Windows App Distribution
But, I promised you to tell you how to do unpackaged app distribution. In this case we don’t get an MSIX file, you will just have the exe file and a bunch of DLLs and other files that are needed to run the application, you can zip that, copy that and run it on another machine.
A little disclaimer: I already mentioned that when using an MSIX, all the prerequisites will be checked on the users machine. For instance Windows App SDK needs to be installed, the Visual C++ redistributable files need to be installed. That are all things that the user needs to take into account themselves in this scenario.
Enable Unpackaged Distribution
Enabling unpackaged distribution can be done in 2 steps
- Add a <WindowsPackageType> node to your .NET MAUI csproj file
Open the project file of your .NET MAUI app and add the <WindowsPackageType>None</WindowsPackageType> node to a PropertyGroup. If you want to make sure that this only happens for Windows builds, add a Condition attribute to it.
- In your launchSettings.json set commandName to Project
Find the launchSettings.json file under the Properties folder and find the commandName key. The value is now set to MsixPackage, change that to be Project.
That’s it! That is all you need to do to make your .NET MAUI Windows app build as an unpackaged app.
While you can now distribute your app much easier, beware that the app might not run if the user does not have all the necessary bit installed. Read more on what you need to run a WinUI app in the documentation.
The steps you take aren’t very extensive, but if you would like to see how it fits together in a project, check out this GitHub repository.
Everything shown here is in early stages. There is no UI tooling yet to support this. If you run into anything, please open an issue on the .NET MAUI GitHub repository with all the details you can spare.
PS. This should work for WinUI apps without .NET MAUI as well!