question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add Support for WinUI Unpackaged Apps

See original GitHub issue

Summary

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
  • 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
  • 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 use AppContext.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:closed
  • Created 2 years ago
  • Reactions:16
  • Comments:18 (13 by maintainers)

github_iconTop GitHub Comments

6reactions
mattleibowcommented, Jul 1, 2022

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.

3reactions
mattleibowcommented, Apr 29, 2022

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Build and deploy an unpackaged app using Preview and ...
This article provides a walkthrough for building and deploying an unpackaged app that uses the Preview and Experimental versions of Windows ...
Read more >
Windows App SDK deployment guide for framework ...
This topic provides guidance about deploying apps that are packaged with external location, or are unpackaged, and that use the Windows App ......
Read more >
Packaged, Unpackaged and Self-Contained WinUI 3 Apps ...
Now that we're a bit more familiar with the way our WinUI application starts, let's take a look at how support for unpackaged...
Read more >
Microsoft release Windows App SDK 1.0 Preview 3 with ...
Unpackaged WinUI 3 applications are supported on x86 and x64, arm64 support will be added in the next stable release.
Read more >
Creating the first Windows App SDK project
Adding support to an existing application. All the features of the Windows App SDK other than WinUI can also be used by existing...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found