Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support for WinUI Unpackaged Apps #3166

Closed
10 of 13 tasks
Tracked by #10564
mattleibow opened this issue Oct 28, 2021 · 18 comments · Fixed by #5880
Closed
10 of 13 tasks
Tracked by #10564

Add Support for WinUI Unpackaged Apps #3166

mattleibow opened this issue Oct 28, 2021 · 18 comments · Fixed by #5880
Assignees
Labels
area-blazor Blazor Hybrid / Desktop, BlazorWebView fixed-in-6.0.200-preview.14.2 Look for this fix in 6.0.200-preview.14.2! fixed-in-6.0.300-rc.2 Look for this fix in 6.0.300-rc.2! good first issue Good for newcomers platform/windows 🪟 t/desktop The issue relates to desktop scenarios (MacOS/MacCatalyst/Windows/WinUI/WinAppSDK)
Milestone

Comments

@mattleibow
Copy link
Member

mattleibow commented Oct 28, 2021

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:

Related Issues

@mattleibow
Copy link
Member Author

@Eilon could you review all the usages the Xxx.Current listed above in the blazor parts. @danroth27 got Blazor working as unpackaged, so I am not sure how it all worked. Just invoking the Current property causes a crash, so you must be working some magic!

@mattleibow mattleibow changed the title Add support for unpackaged apps Add better support for unpackaged apps Feb 17, 2022
@Redth Redth added the good first issue Good for newcomers label Mar 8, 2022
@mattleibow
Copy link
Member Author

a lot of code can probably come from here: xamarin/Essentials#1079

@mattleibow
Copy link
Member Author

@javiercn here is a list of things to check for.

@javiercn
Copy link
Member

@mattleibow I tried this on the maui repo and it doesn't seem to be working:
image

The issue happens both with the sandbox and the single project projects. I did setup things up as described above

@mprogers
Copy link

I got our IT group to install Visual Studio 2022 (woo-hoo!) since it's come out of preview, brilliant timing. However, trying to run a .NET MAUI Windows App just now gave me an error - I need to enable developer mode. I have a feeling our IT staff is not going to be amenable to this, and my search led to this issue. Am I in the right place? And is there a way around this? I thought perhaps I could do Android, but that too required admin credentials.

@haslingerm
Copy link

I got our IT group to install Visual Studio 2022 (woo-hoo!) since it's come out of preview, brilliant timing. However, trying to run a .NET MAUI Windows App just now gave me an error - I need to enable developer mode. I have a feeling our IT staff is not going to be amenable to this, and my search led to this issue. Am I in the right place? And is there a way around this? I thought perhaps I could do Android, but that too required admin credentials.

We are in the same situation, but as a college: would love to do MAUI dev with the students, but the IT stuff is very reluctant to enable developer mode => it's already a no-go for the current year now, but I hope this restriction will be lifted and we can give it a go next year.

@MagicAndre1981
Copy link
Contributor

for android you also need to enable developer options and allow USB/Wifi debugging to deploy/debug apps. So there is no difference

@haslingerm
Copy link

for android you also need to enable developer options and allow USB/Wifi debugging to deploy/debug apps. So there is no difference

The difference is that phones are owned and operated by students, plus we can use the emulator. The PCs are managed by our IT staff who refuse to turn on developer mode so we are stuck with WPF for now. If possible, I'd like this requirement to be removed.

@Redth Redth modified the milestones: 7.0-rc2, .NET 7 Planning Sep 14, 2022
@mkArtakMSFT mkArtakMSFT added area-blazor Blazor Hybrid / Desktop, BlazorWebView and removed area-blazor Blazor Hybrid / Desktop, BlazorWebView labels Sep 19, 2022
@mkArtakMSFT mkArtakMSFT modified the milestones: .NET 7 Planning, 7.0 Sep 19, 2022
@Redth Redth modified the milestones: .NET 7 Planning, 7.0 Oct 4, 2022
@mattleibow
Copy link
Member Author

Closing this as I believe all the bits of code should now be working or have known issues. See #8552 for the complete list.

@ghost ghost locked as resolved and limited conversation to collaborators Nov 6, 2022
@samhouts samhouts added the fixed-in-6.0.300-rc.2 Look for this fix in 6.0.300-rc.2! label Feb 17, 2023
@samhouts samhouts added the fixed-in-6.0.200-preview.14.2 Look for this fix in 6.0.200-preview.14.2! label Jul 20, 2023
@Eilon Eilon added t/desktop The issue relates to desktop scenarios (MacOS/MacCatalyst/Windows/WinUI/WinAppSDK) and removed legacy-area-desktop Windows / WinUI / Project Reunion & Mac Catalyst / macOS specifics (Menus & other Controls)) labels May 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Blazor Hybrid / Desktop, BlazorWebView fixed-in-6.0.200-preview.14.2 Look for this fix in 6.0.200-preview.14.2! fixed-in-6.0.300-rc.2 Look for this fix in 6.0.300-rc.2! good first issue Good for newcomers platform/windows 🪟 t/desktop The issue relates to desktop scenarios (MacOS/MacCatalyst/Windows/WinUI/WinAppSDK)
Projects
None yet
Development

Successfully merging a pull request may close this issue.