- PowerToys throws exception when close PowerToys Run, we can get log files location in
%appdata%\..\Local\Microsoft\PowerToys\PowerToys Run\Logs\0.57.2.0\
. Open PowerToys Run will active these broken plugins, log system will print detail in these file.[2022-04-21 19:49:00.7245] [ERROR] [C:\a\_work\1\s\src\modules\launcher\Wox.Plugin\PluginPair.cs::154] -------------------------- Begin exception -------------------------- Message: Couldn't get assembly types for Everything in C:\Program Files\PowerToys\modules\launcher\Plugins\Community.PowerToys.Run.Plugin.Everything\Community.PowerToys.Run.Plugin.Everything.dll. The plugin might be corrupted. Uninstall PowerToys, manually delete the install folder and reinstall. Exception full name : System.Reflection.ReflectionTypeLoadException Exception message : Unable to load one or more of the requested types. Could not load file or assembly 'Microsoft.PowerToys.Settings.UI.Lib, Version=0.0.1.0, Culture=neutral, PublicKeyToken=null'. 系统找不到指定的文件。 Exception stack trace: at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module) at System.Reflection.Assembly.GetTypes() at Wox.Plugin.PluginPair.CreatePluginInstance() Exception source : System.Private.CoreLib Exception target site: System.RuntimeType[] GetTypes(System.Reflection.RuntimeModule) Exception HResult : -2146232830 -------------------------- End exception -------------------------- ... [2022-04-21 19:49:01.8673] [ERROR] [C:\a\_work\1\s\src\modules\launcher\Wox.Plugin\PluginPair.cs::204] -------------------------- Begin exception -------------------------- Message: Fail to Init plugin: Web Search Exception full name : System.IO.FileNotFoundException Exception message : Could not load file or assembly 'ManagedCommon, Version=0.0.1.0, Culture=neutral, PublicKeyToken=null'. 系统找不到指定的文件。 Exception stack trace: at Top.Iseason.PTPlugins.WebSearch.Main.Init(PluginInitContext context) at Wox.Plugin.PluginPair.InitPlugin(IPublicAPI api) Exception source : Top.Iseason.PTPlugins.WebSearch Exception target site: Void Init(Wox.Plugin.PluginInitContext) Exception HResult : -2147024894 -------------------------- End exception --------------------------
- Find problem is PowerToys core can not find dll by plugins needed, but the
Microsoft.PowerToys.Settings.UI.Lib
andManagedCommon
are core's lib by PowerToys Run, just because developers changed their namespace. - Simply fix: First, download plugins source.
- Copy the libraries needed by the plugin from PowerToys install directory
C:\Program Files\PowerToys\modules\launcher
.- Everything:
PowerToys.Common.UI.dll
PowerToys.Interop.dll
PowerToys.ManagedCommon.dll
PowerToys.ManagedTelemetry.dll
PowerToys.Settings.UI.Lib.dll
System.IO.Abstractions.dll
Wox.Infrastructure.dll
Wox.Plugin.dll
- WebSearch:
PowerToys.Common.UI.dll
PowerToys.ManagedCommon.dll
System.IO.Abstractions.dll
Wox.Infrastructure.dll
Wox.Plugin.dll
- Everything:
- Change project's file
.csproj
- Everything:
- PropertyGroup -> TargetFramework -> change to
netcoreapp6.0-windows
because useWPF is true - Change ItemGroup tag with linked other parent project to these:
<ItemGroup> <Reference Include="PowerToys.Common.UI"> <HintPath>.lib/PowerToys.Common.UI.dll</HintPath> </Reference> <Reference Include="PowerToys.Interop"> <HintPath>.lib/PowerToys.Interop.dll</HintPath> </Reference> <Reference Include="PowerToys.ManagedCommon"> <HintPath>.lib/PowerToys.ManagedCommon.dll</HintPath> </Reference> <Reference Include="PowerToys.ManagedTelemetry"> <HintPath>.lib/PowerToys.ManagedTelemetry.dll</HintPath> </Reference> <Reference Include="PowerToys.Settings.UI.Lib"> <HintPath>.lib/PowerToys.Settings.UI.Lib.dll</HintPath> </Reference> <Reference Include="System.IO.Abstractions"> <HintPath>.lib/System.IO.Abstractions.dll</HintPath> </Reference> <Reference Include="Wox.Infrastructure"> <HintPath>.lib/Wox.Infrastructure.dll</HintPath> </Reference> <Reference Include="Wox.Plugin"> <HintPath>.lib/Wox.Plugin.dll</HintPath> </Reference> </ItemGroup>
- PropertyGroup -> TargetFramework -> change to
- WebSearch:
- PropertyGroup -> TargetFramework -> change to
netcoreapp6.0-windows
because UseWindowsForms is true - Change ItemGroup tag with linked other parent project to these:
<ItemGroup> <Reference Include="PowerToys.Common.UI"> <HintPath>.lib/PowerToys.Common.UI.dll</HintPath> </Reference> <Reference Include="PowerToys.ManagedCommon"> <HintPath>.lib/PowerToys.ManagedCommon.dll</HintPath> </Reference> <Reference Include="System.IO.Abstractions"> <HintPath>.lib/System.IO.Abstractions.dll</HintPath> </Reference> <Reference Include="Wox.Infrastructure"> <HintPath>.lib/Wox.Infrastructure.dll</HintPath> </Reference> <Reference Include="Wox.Plugin"> <HintPath>.lib/Wox.Plugin.dll</HintPath> </Reference> </ItemGroup>
- Copy
https://github.com/microsoft/PowerToys/tree/main/src/codeAnalysis
in project source and remove ItemGroup tag with these Included files:
<ItemGroup> <Compile Include="..\..\..\..\codeAnalysis\GlobalSuppressions.cs"> <Link>GlobalSuppressions.cs</Link> </Compile> <AdditionalFiles Include="..\..\..\..\codeAnalysis\StyleCop.json"> <Link>StyleCop.json</Link> </AdditionalFiles> </ItemGroup>
- PropertyGroup -> TargetFramework -> change to
- Everything:
- Use dotnet sdk run
dotnet clean
anddotnet build
to build dll and files. - Copy
bin/Debug/
files to PowerToys Run plugin directory to replace old plugin files. All done.
- 根据
%appdata%\..\Local\Microsoft\PowerToys\PowerToys Run\Logs\0.57.2.0\
处的日志文件可以获得报错详情,本次处理的问题是由于开发者更换了核心库的命名空间导致的。 - 下载两个插件的源码
- 从PowerToys安装目录
C:\Program Files\PowerToys\modules\launcher
拷贝以下dll到源码目录中(建立一个文件夹用来放第三方库如lib).- Everything:
PowerToys.Common.UI.dll
PowerToys.Interop.dll
PowerToys.ManagedCommon.dll
PowerToys.ManagedTelemetry.dll
PowerToys.Settings.UI.Lib.dll
System.IO.Abstractions.dll
Wox.Infrastructure.dll
Wox.Plugin.dll
- WebSearch:
PowerToys.Common.UI.dll
PowerToys.ManagedCommon.dll
System.IO.Abstractions.dll
Wox.Infrastructure.dll
Wox.Plugin.dll
- Everything:
- 修改
.csproj
项目文件- Everything:
- PropertyGroup -> TargetFramework -> 改成
netcoreapp6.0-windows
- 改变包含引用父项目结构的ItemGroup标签为以下内容:
<ItemGroup> <Reference Include="PowerToys.Common.UI"> <HintPath>.lib/PowerToys.Common.UI.dll</HintPath> </Reference> <Reference Include="PowerToys.Interop"> <HintPath>.lib/PowerToys.Interop.dll</HintPath> </Reference> <Reference Include="PowerToys.ManagedCommon"> <HintPath>.lib/PowerToys.ManagedCommon.dll</HintPath> </Reference> <Reference Include="PowerToys.ManagedTelemetry"> <HintPath>.lib/PowerToys.ManagedTelemetry.dll</HintPath> </Reference> <Reference Include="PowerToys.Settings.UI.Lib"> <HintPath>.lib/PowerToys.Settings.UI.Lib.dll</HintPath> </Reference> <Reference Include="System.IO.Abstractions"> <HintPath>.lib/System.IO.Abstractions.dll</HintPath> </Reference> <Reference Include="Wox.Infrastructure"> <HintPath>.lib/Wox.Infrastructure.dll</HintPath> </Reference> <Reference Include="Wox.Plugin"> <HintPath>.lib/Wox.Plugin.dll</HintPath> </Reference> </ItemGroup>
- PropertyGroup -> TargetFramework -> 改成
- WebSearch:
- PropertyGroup -> TargetFramework -> 改成
netcoreapp6.0-windows
- 改变包含引用父项目结构(ProjectReference)的ItemGroup标签为以下内容:
<ItemGroup> <Reference Include="PowerToys.Common.UI"> <HintPath>.lib/PowerToys.Common.UI.dll</HintPath> </Reference> <Reference Include="PowerToys.ManagedCommon"> <HintPath>.lib/PowerToys.ManagedCommon.dll</HintPath> </Reference> <Reference Include="System.IO.Abstractions"> <HintPath>.lib/System.IO.Abstractions.dll</HintPath> </Reference> <Reference Include="Wox.Infrastructure"> <HintPath>.lib/Wox.Infrastructure.dll</HintPath> </Reference> <Reference Include="Wox.Plugin"> <HintPath>.lib/Wox.Plugin.dll</HintPath> </Reference> </ItemGroup>
- 拷贝
https://github.com/microsoft/PowerToys/tree/main/src/codeAnalysis
这个目录到源码中,并移除这些额外添加的标签:
<ItemGroup> <Compile Include="..\..\..\..\codeAnalysis\GlobalSuppressions.cs"> <Link>GlobalSuppressions.cs</Link> </Compile> <AdditionalFiles Include="..\..\..\..\codeAnalysis\StyleCop.json"> <Link>StyleCop.json</Link> </AdditionalFiles> </ItemGroup>
- PropertyGroup -> TargetFramework -> 改成
- Everything:
- 使用dotnet sdk 执行
dotnet clean
和dotnet build
来构建项目。 - 复制项目的
bin/Debug/
内的文件至 PowerToys Run 插件目录替换掉旧的插件文件,即可正常使用。