From 301d4d91107cee74286c54bd13d09552f12ee76f Mon Sep 17 00:00:00 2001 From: Luis von der Eltz Date: Wed, 8 Sep 2021 13:49:34 +0200 Subject: [PATCH] Add support for .NET 5 --- .../DesktopNotifications.Apple.csproj | 4 ++-- .../DesktopNotifications.Avalonia.csproj | 4 ++-- .../DesktopNotifications.FreeDesktop.csproj | 4 ++-- .../DesktopNotifications.Windows.csproj | 6 +++--- DesktopNotifications.Windows/WindowsApplicationContext.cs | 6 ++++++ DesktopNotifications.Windows/WindowsNotificationManager.cs | 2 +- DesktopNotifications/DesktopNotifications.csproj | 4 ++-- Example.Avalonia/Example.Avalonia.csproj | 4 ++-- Example/Example.csproj | 2 +- 9 files changed, 21 insertions(+), 15 deletions(-) diff --git a/DesktopNotifications.Apple/DesktopNotifications.Apple.csproj b/DesktopNotifications.Apple/DesktopNotifications.Apple.csproj index a3d9fd3..26c116d 100644 --- a/DesktopNotifications.Apple/DesktopNotifications.Apple.csproj +++ b/DesktopNotifications.Apple/DesktopNotifications.Apple.csproj @@ -1,7 +1,7 @@ - + - netcoreapp3.1 + netcoreapp3.1;net5.0-windows10.0.17763.0 enable true A cross-platform C# library for native desktop "toast" notifications. diff --git a/DesktopNotifications.Avalonia/DesktopNotifications.Avalonia.csproj b/DesktopNotifications.Avalonia/DesktopNotifications.Avalonia.csproj index eedc31b..c6e5cfa 100644 --- a/DesktopNotifications.Avalonia/DesktopNotifications.Avalonia.csproj +++ b/DesktopNotifications.Avalonia/DesktopNotifications.Avalonia.csproj @@ -1,7 +1,7 @@ - + - netcoreapp3.1 + netcoreapp3.1;net5.0-windows10.0.17763.0 A cross-platform C# library for native desktop "toast" notifications. true MIT diff --git a/DesktopNotifications.FreeDesktop/DesktopNotifications.FreeDesktop.csproj b/DesktopNotifications.FreeDesktop/DesktopNotifications.FreeDesktop.csproj index 1fc189a..4aff672 100644 --- a/DesktopNotifications.FreeDesktop/DesktopNotifications.FreeDesktop.csproj +++ b/DesktopNotifications.FreeDesktop/DesktopNotifications.FreeDesktop.csproj @@ -1,7 +1,7 @@ - + - netcoreapp3.1 + netcoreapp3.1;net5.0-windows10.0.17763.0 enable A cross-platform C# library for native desktop "toast" notifications. true diff --git a/DesktopNotifications.Windows/DesktopNotifications.Windows.csproj b/DesktopNotifications.Windows/DesktopNotifications.Windows.csproj index 76e91f0..e7a8bf4 100644 --- a/DesktopNotifications.Windows/DesktopNotifications.Windows.csproj +++ b/DesktopNotifications.Windows/DesktopNotifications.Windows.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1 + netcoreapp3.1;net5.0-windows10.0.17763.0 enable true A cross-platform C# library for native desktop "toast" notifications. @@ -11,7 +11,7 @@ - + - + \ No newline at end of file diff --git a/DesktopNotifications.Windows/WindowsApplicationContext.cs b/DesktopNotifications.Windows/WindowsApplicationContext.cs index 537e7ef..f2e06b6 100644 --- a/DesktopNotifications.Windows/WindowsApplicationContext.cs +++ b/DesktopNotifications.Windows/WindowsApplicationContext.cs @@ -23,6 +23,12 @@ namespace DesktopNotifications.Windows string? appUserModelId = null) { var mainModule = Process.GetCurrentProcess().MainModule; + + if (mainModule?.FileName == null) + { + throw new InvalidOperationException(); + } + var appName = customName ?? Path.GetFileNameWithoutExtension(mainModule.FileName); var aumid = appUserModelId ?? appName; //TODO: Add seeded bits to avoid collisions? diff --git a/DesktopNotifications.Windows/WindowsNotificationManager.cs b/DesktopNotifications.Windows/WindowsNotificationManager.cs index 4483f25..32ca9a2 100644 --- a/DesktopNotifications.Windows/WindowsNotificationManager.cs +++ b/DesktopNotifications.Windows/WindowsNotificationManager.cs @@ -14,7 +14,7 @@ namespace DesktopNotifications.Windows private readonly WindowsApplicationContext _applicationContext; private readonly TaskCompletionSource? _launchActionPromise; private readonly Dictionary _notifications; - private readonly ToastNotifier _toastNotifier; + private readonly ToastNotifierCompat _toastNotifier; /// /// diff --git a/DesktopNotifications/DesktopNotifications.csproj b/DesktopNotifications/DesktopNotifications.csproj index 3b73338..8b09245 100644 --- a/DesktopNotifications/DesktopNotifications.csproj +++ b/DesktopNotifications/DesktopNotifications.csproj @@ -1,7 +1,7 @@ - + - netcoreapp3.1 + netcoreapp3.1;net5.0-windows10.0.17763.0 enable true A cross-platform C# library for native desktop "toast" notifications. diff --git a/Example.Avalonia/Example.Avalonia.csproj b/Example.Avalonia/Example.Avalonia.csproj index c51e7e1..fef03d2 100644 --- a/Example.Avalonia/Example.Avalonia.csproj +++ b/Example.Avalonia/Example.Avalonia.csproj @@ -1,7 +1,7 @@ - + WinExe - netcoreapp3.1 + netcoreapp3.1;net5.0-windows10.0.17763.0 enable diff --git a/Example/Example.csproj b/Example/Example.csproj index 3ab9042..6aab8ac 100644 --- a/Example/Example.csproj +++ b/Example/Example.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + netcoreapp3.1;net5.0-windows10.0.17763.0 enable