From 89c4a45c3c065daf2b9e164e12f0af410406da9a Mon Sep 17 00:00:00 2001 From: Martin Zikmund Date: Wed, 18 Sep 2024 13:48:34 +0200 Subject: [PATCH] feat: Avoid startup exception for WinAppSDK Unpackaged apps --- src/Resizetizer/src/WindowIconGeneratorTask.cs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/Resizetizer/src/WindowIconGeneratorTask.cs b/src/Resizetizer/src/WindowIconGeneratorTask.cs index 257d383..b39002f 100644 --- a/src/Resizetizer/src/WindowIconGeneratorTask.cs +++ b/src/Resizetizer/src/WindowIconGeneratorTask.cs @@ -78,17 +78,11 @@ public static void SetWindowIcon(this global::Microsoft.UI.Xaml.Window window) static bool IsPackaged() {{ - try - {{ - if (global::Windows.ApplicationModel.Package.Current != null) - return true; - }} - catch - {{ - // no-op - }} - +#if WINAPPSDK_PACKAGED // Defined in the Uno.Sdk for WinAppSDK Packaged apps. + return true; +#else return false; +#endif }} #endif }}