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

Initial work to get unpackaged WinUI apps #4460

Merged
merged 7 commits into from
Feb 16, 2022
Merged

Conversation

mattleibow
Copy link
Member

@mattleibow mattleibow commented Feb 1, 2022

Description of Change

This PR gets the very basic in place to allow the Maui sample app to launch as an unpackaged app.

Partially implements #3166

public interface IAppInfo
{
	string PackageName { get; }
	string Name { get; }
	string VersionString { get; }
	Version Version { get; }
	string BuildString { get; }
	void ShowSettingsUI();
	AppTheme RequestedTheme { get; }
	AppPackagingModel PackagingModel { get; }
}

public enum AppPackagingModel
{
	Packaged,
	Unpackaged,
}

Notes

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

@davidbuckleyni
Copy link

We shouldn't just rip out the option to have packaged as well it should be an option

@mattleibow
Copy link
Member Author

We shouldn't just rip out the option to have packaged as well it should be an option

Yup! We t both. It is literally just a MSBuild property (and then the updated launchSettings.json). Both can work in the same project seamlessly.

src/Controls/samples/Controls.Sample/Startup.cs Outdated Show resolved Hide resolved
@@ -25,5 +25,7 @@ public static partial class AppInfo

/// <include file="../../docs/Microsoft.Maui.Essentials/AppInfo.xml" path="//Member[@MemberName='RequestedTheme']/Docs" />
public static AppTheme RequestedTheme => PlatformRequestedTheme();

public static bool IsPackagedApp => PlatformIsPackagedApp();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a new API and we may want to change this a bit. Not sure if this is the right name, but basically represents a single package that is "installed" on the OS using the OS "store" or sideloading. This does not mean that using some single file, .msi installer magically makes it work. It means that the app has no package identity. Probably need a new name tbh.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An example is that a macOS/Cocoa app might be packaged but a WPF app will never be. Unless the rules change if the app is published to the store as a Win32 app. Then it probably gets a package identifier.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Packaged isn't a bad choice. I also think something along the lines of what the "App Model" is. Should this be more than a bool, and maybe an enum?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ooh, sounds like a good idea there.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a third model? There doesn't have to be one to use an enum, but is it possible to have a third? The 2 modes I can think of: "in a self contained package with an ID" and "just a folder on disk"

I tested the APIs with a WinForms app and the Windows Application Packaging Project, and that uses the same native APIs that throw when run as an exe and has an ID when using the packaging project.

@mattleibow mattleibow self-assigned this Feb 2, 2022
# Conflicts:
#	src/Essentials/src/AppInfo/AppInfo.android.cs
#	src/Essentials/src/AppInfo/AppInfo.netstandard.cs
#	src/Essentials/src/AppInfo/AppInfo.shared.cs
#	src/Essentials/src/AppInfo/AppInfo.tizen.cs
#	src/Essentials/src/AppInfo/AppInfo.uwp.cs
#	src/Essentials/src/FileSystem/FileSystem.ios.tvos.watchos.macos.cs
@davidbuckleyni
Copy link

Will we not need ot make sure that the ziped still is allow some people might prefare their app being single executable in fact that was whole point of .net 6 was it not? @mattleibow

@mattleibow
Copy link
Member Author

That is correct. This code is just our sample app. And, it is adding the feature. So after this PR, our sample will build as a store packaged app or a exe from a folder.

@Eilon Eilon added the legacy-area-desktop Windows / WinUI / Project Reunion & Mac Catalyst / macOS specifics (Menus & other Controls)) label Feb 10, 2022
@mattleibow mattleibow merged commit b8bf9f5 into main Feb 16, 2022
@mattleibow mattleibow deleted the dev/unpackaged-support branch February 16, 2022 06:52
@mattleibow mattleibow added this to the 6.0.300-preview.14 milestone Feb 16, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Dec 22, 2023
@Eilon Eilon added the t/desktop The issue relates to desktop scenarios (MacOS/MacCatalyst/Windows/WinUI/WinAppSDK) label May 10, 2024
@samhouts samhouts added the fixed-in-6.0.200-preview.14.2 Look for this fix in 6.0.200-preview.14.2! label Aug 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
fixed-in-6.0.200-preview.14.2 Look for this fix in 6.0.200-preview.14.2! legacy-area-desktop Windows / WinUI / Project Reunion & Mac Catalyst / macOS specifics (Menus & other Controls)) t/desktop The issue relates to desktop scenarios (MacOS/MacCatalyst/Windows/WinUI/WinAppSDK)
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants