Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

create normal windows desktop application using .net maui?

I'm planing to create a cross platform application. Minimal supported platforms should be android and windows. I'd like to end up with a classical windows executable, not a UWP app. The new maui platform looks like it might fit.

I've already downloaded the current pre-release version of visual studio 2022 and create a new maui project. When I compile and run it on windows the application visual studio creates is a UWP app. The official microsoft page for maui states:

.NET Multi-platform App UI (.NET MAUI) apps can be written for the following platforms:

Android 5.0 (API 21) or higher. iOS 10 or higher. macOS 10.13 or higher, using Mac Catalyst. Windows 11 and Windows 10 version 1809 or higher, using Windows UI Library (WinUI) 3.

https://learn.microsoft.com/en-us/dotnet/maui/supported-platforms

The following issue on github also looks like it might be possible to create a widnows executable:

Publishing to an exe (not self-contained) works but don't take the published folder files, take the build artifacts, see bullet 3 below for all the details

https://github.com/dotnet/maui/issues/4329

I'm a bit confused about the details of the support for windows. Is only windows possible to create a UWP app or can I compile it to a normal desktop application? Can I change the output to be a normal windows executable, if so how?

like image 420
mugu90 Avatar asked Jan 30 '26 19:01

mugu90


2 Answers

.NET Maui Apps are not UWP apps. They are built using WinUI 3 and the Windows App SDK which produces a Win32 app. Information about the Windows App SDK can be found here and information regarding different app types can be found here.

If you are asking if it is possible to publish a Windows executable file (.exe) then that is not possible. .NET MAUI only allows publishing an MSIX package.

like image 109
Matt Avatar answered Feb 01 '26 09:02

Matt


This is the only way that worked for me, but it is a little bugged.

Open a terminal and run the following command:

msbuild /restore /t:Publish /p:TargetFramework=net6.0-windows10.0.19041 /p:configuration=release /p:WindowsAppSDKSelfContained=true /p:Platform="any CPU" /p:PublishSingleFile=true /p:WindowsPackageType=None /p:RuntimeIdentifier=win10-x64

The build file can be found in \bin\x64\release\net6.0-windows10.0.19041\win10-x64\publish

like image 35
emilim Avatar answered Feb 01 '26 11:02

emilim



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!