Add Support for WinUI Unpackaged Apps
See original GitHub issueSummary
Since the release of the Windows App SDK Preview 3, we can now use unpackaged apps: https://docs.microsoft.com/en-us/windows/apps/winui/winui3/create-your-first-winui3-app?pivots=winui3-unpackaged-csharp
-
Packaged apps: Packaged apps are packaged using MSIX. MSIX is a package format that gives end-users an easy way to install, uninstall, and update their Windows apps using a modern UI.
- Framework Dependent:
dotnet publish -f net6.0-windows
- Self-Contained:
dotnet publish -f net6.0-windows -p:SelfContained=true -p:WindowsAppSDKSelfContained=true
- Framework Dependent:
-
Unpackaged apps: Unpackaged apps don’t use MSIX. They’re typically installed and updated using .exe or .msi files. Many unpackaged apps walk end-users through an installation wizard using a classic UI.
- Framework Dependent:
dotnet publish -f net6.0-windows -p:WindowsPackageType=None
- Self-Contained:
dotnet publish -f net6.0-windows -p:WindowsPackageType=None -p:SelfContained=true -p:WindowsAppSDKSelfContained=true
- Framework Dependent:
-
Self-Contained: For either Packaged or Unpackaged apps, publishing self-contained provides a way to ship a complete set of application artifacts which do not rely on any shared/globally installed frameworks.
.csproj changes
-<WindowsPackageType>MSIX</WindowsPackageType>
+<WindowsPackageType>None</WindowsPackageType>
Improved self contained:
+<WindowsAppSDKSelfContained Condition="'$(IsUnpackaged)' == 'true'">true</WindowsAppSDKSelfContained>
+<SelfContained Condition="'$(IsUnpackaged)' == 'true'">true</SelfContained>
launchSettings.json changes
{
"profiles": {
"Windows Machine": {
- "commandName": "MsixPackage"
+ "commandName": "Project"
,
}
}
You will need to download and install the Windows App SDK runtime and MSIX packages which are required to run and deploy unpackaged apps: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/downloads
For example, for the stable 1.0.0 version of the Windows App SDK, you will need to download and install: https://aka.ms/windowsappsdk/1.0-stable/msix-installer
In order to install the SDK, you may need to manually install the App Installer first: https://www.microsoft.com/store/productId/9NBLGGH4NNS1
Work To Do
Some changes we need to make/have:
- Allow the .net sdk to manage the native bootstrap.dll dependency (WASDK)
This is basically putting the native dlls in the correct runtimes/win-/native/.dll path
https://github.com/microsoft/WindowsAppSDK/pull/1498 - Upate the templates to use the win10-* RIDs: (MAUI)
- https://github.com/dotnet/maui/pull/3185 - Fix some cases where we assume a packaged app: (MAUI)
_Some info can be obtained from the results of this task too: https://github.com/dotnet/maui/pull/2704_
As more are found, please add it to this description so we can let the WinUI team know.- #8419
-
Package.Current
#8536-
Package.Current.InstalledLocation
- I can useAppContext.BaseDirectory
instead -
Package.Current.Id.Name
- this could be the assembly name -
Package.Current.DisplayName
- this could also be the assembly name or also look into attributes in the dll (which we could add too) -
Package.Current.Id
- this could be the assembly version (which we can also set)
-
- Usage of the
AppxManifest.xml
file - this does not exist in unpackaged and all checks should assume it is declared/correct - Add tests to validate all publishing scenarios
- #8432
- Some Essentials APIs are not working as expected: #8552
Related Issues
Issue Analytics
- State:
- Created 2 years ago
- Reactions:16
- Comments:18 (13 by maintainers)
I created a repo and this commit converts the current public maui from a a packaged app to an unpackaged app: https://github.com/mattleibow/MauiUnpackaged/commit/12fef2e1aecc7f6808dcf4ddb6281bac51db50c9
Once some PRs are merged, all this goes away.
Yes, but I am not sure if WinUI is ready for that just yet. I think there is ongoing discussion on this windows self contained story.
Might be a 1.1 or 1.2 feature.