[PowerToys Run] Update to net5 (#12434)

* [Setup] Add support for installing both dotnet 3 and 5 (#12306)

* [PowerToys Run] Update to net5 (#12286)

* Change targets of projects

* Update Microsoft.Toolkit.Uwp.Notifications,

changed TargetFramework for PowerLauncher project in order to resolve an issue with ModernWpf

* Specify windows version in order to fix build errors

* Fixed suppressed warnings

* Updated sdk

* Removed usage of obsolete GlobalAssemblyCache

* Removed obsolete DesktopNotificationManagerCompat

* Update nuget versions

* Update installer

* [PowerToys Run] Obsolete APIs and warnings introduced in .net5 (#12423)

* Change targets of projects

* Update Microsoft.Toolkit.Uwp.Notifications,

changed TargetFramework for PowerLauncher project in order to resolve an issue with ModernWpf

* Fixed suppressed warnings

* Removed obsolete DesktopNotificationManagerCompat

* Get rid of binary formatter

* Update tests

* Don't include new image cache file to the report

* There's no need to call IsOwner as it doesn't make sense

* Fix different nullability exception

* Exclude extra dlls from tests

Co-authored-by: Andrey Nekrasov <yuyoyuppe@users.noreply.github.com>
This commit is contained in:
Mykhailo Pylyp
2021-07-21 19:02:45 +03:00
committed by GitHub
parent 37132c91e6
commit c651a4b36e
58 changed files with 180 additions and 402 deletions

View File

@@ -43,7 +43,7 @@ namespace PowerLauncher
[STAThread]
public static void Main()
{
Log.Info($"Starting PowerToys Run with PID={Process.GetCurrentProcess().Id}", typeof(App));
Log.Info($"Starting PowerToys Run with PID={Environment.ProcessId}", typeof(App));
int powerToysPid = GetPowerToysPId();
if (powerToysPid != 0)
{

View File

@@ -1,23 +0,0 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Runtime.InteropServices;
using Microsoft.Toolkit.Uwp.Notifications;
namespace PowerLauncher.Helper
{
[ClassInterface(ClassInterfaceType.None)]
#pragma warning disable CS0618 // Type or member is obsolete
[ComSourceInterfaces(typeof(INotificationActivationCallback))]
#pragma warning restore CS0618 // Type or member is obsolete
[Guid("DD5CACDA-7C2E-4997-A62A-04A597B58F76")]
[ComVisible(true)]
public class LauncherNotificationActivator : NotificationActivator
{
public override void OnActivated(string invokedArgs, NotificationUserInput userInput, string appUserModelId)
{
}
}
}

View File

@@ -114,7 +114,7 @@ namespace PowerLauncher.Helper
// get current active window
IntPtr hWnd = NativeMethods.GetForegroundWindow();
if (hWnd != null && !hWnd.Equals(IntPtr.Zero))
if (!hWnd.Equals(IntPtr.Zero))
{
// if current active window is NOT desktop or shell
if (!(hWnd.Equals(HWND_DESKTOP) || hWnd.Equals(HWND_SHELL)))
@@ -142,7 +142,7 @@ namespace PowerLauncher.Helper
{
IntPtr hWndDesktop = NativeMethods.FindWindowEx(hWnd, IntPtr.Zero, "SHELLDLL_DefView", null);
hWndDesktop = NativeMethods.FindWindowEx(hWndDesktop, IntPtr.Zero, "SysListView32", "FolderView");
if (hWndDesktop != null && !hWndDesktop.Equals(IntPtr.Zero))
if (!hWndDesktop.Equals(IntPtr.Zero))
{
return false;
}

View File

@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\Version.props" />
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0-windows10.0.18362.0</TargetFramework>
<UseWPF>true</UseWPF>
<UseWindowsForms>true</UseWindowsForms>
<StartupObject>PowerLauncher.App</StartupObject>
@@ -89,31 +89,31 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2020.1.0" />
<PackageReference Include="JetBrains.Annotations" Version="2021.1.0" />
<PackageReference Include="Mages" Version="2.0.0">
<NoWarn>NU1701</NoWarn>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.3.0">
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.3.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications" Version="6.1.1" />
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.19" />
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications" Version="7.0.2" />
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.31" />
<PackageReference Include="ModernWpfUI" Version="0.9.4" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="NuGet.CommandLine" Version="5.7.0">
<PackageReference Include="NuGet.CommandLine" Version="5.9.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="SharpZipLib" Version="1.2.0" />
<PackageReference Include="SharpZipLib" Version="1.3.2" />
<PackageReference Include="System.Runtime" Version="4.3.1" />
<PackageReference Include="Microsoft.VCRTForwarders.140" Version="1.0.6" />
<PackageReference Include="System.Data.OleDb" Version="4.7.1" />
<PackageReference Include="System.ServiceProcess.ServiceController" Version="4.7.0" />
<PackageReference Include="Microsoft.VCRTForwarders.140" Version="1.0.7" />
<PackageReference Include="System.Data.OleDb" Version="5.0.0" />
<PackageReference Include="System.ServiceProcess.ServiceController" Version="5.0.0" />
<PackageReference Include="tlbimp-Microsoft.Search.Interop" Version="1.0.0">
<NoWarn>NU1701</NoWarn>
</PackageReference>
<PackageReference Include="UnitsNet" Version="4.76.0" />
<PackageReference Include="UnitsNet" Version="4.97.1" />
</ItemGroup>
<ItemGroup>

View File

@@ -35,9 +35,6 @@ namespace Wox
_themeManager = themeManager ?? throw new ArgumentNullException(nameof(themeManager));
_themeManager.ThemeChanged += OnThemeChanged;
WebRequest.RegisterPrefix("data", new DataWebRequestFactory());
DesktopNotificationManagerCompat.RegisterActivator<LauncherNotificationActivator>();
DesktopNotificationManagerCompat.RegisterAumidAndComServer<LauncherNotificationActivator>("PowerToysRun");
}
public void ChangeQuery(string query, bool requery = false)
@@ -96,7 +93,7 @@ namespace Wox
Application.Current.Dispatcher.Invoke(() =>
{
var toast = new ToastNotification(builder.GetToastContent().GetXml());
DesktopNotificationManagerCompat.CreateToastNotifier().Show(toast);
ToastNotificationManagerCompat.CreateToastNotifier().Show(toast);
});
}