You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

WinUI3自包含应用运行失败:调用MddBootstrapInitialize返回ERROR_NOT_FOUND

问题:WinApp SDK自包含部署调用MddBootstrapInitialize失败(ERROR_NOT_FOUND)

安装微软官方Runtime包后,未打包的WinUI3应用可正常运行。但按照WinUI3自包含应用部署指南操作时,将发布文件夹中的文件(含Microsoft.WindowsAppRuntime.Bootstrap.dll)提取到独立目录,调用LoadLibrary()并执行MddBootstrapInitialize时失败,返回ERROR_NOT_FOUND。官方的SelfContained Deployment cpp-console-unpackaged示例也出现相同问题(未打包示例无需调用bootstrap)。

报错日志

'tp2.exe' (Win32): Loaded 'F:\TP2Modules\Turbo Play WinUI3\Microsoft.WindowsAppRuntime.Insights.Resource.dll'. 
\BuildOutput\Release\x64\WindowsAppRuntime_DLL\WindowsAppRuntimeInsights.h(44)\Microsoft.WindowsAppRuntime.Bootstrap.dll!00007FFA0C6D16E5: (caller: 00007FFA0C6D14B6) LogHr(1) tid(4248) 8007029C An assertion failure has occurred.
\BuildOutput\Release\x64\WindowsAppRuntime_DLL\WindowsAppRuntimeInsights.h(44)\Microsoft.WindowsAppRuntime.Bootstrap.dll!00007FFA0C6D16E5: (caller: 00007FFA0C6D14B6) LogHr(2) tid(4248) 8007029C An assertion failure has occurred.
    Msg:[Failed to load resource string. id: 10001] 
'tp2.exe' (Win32): Loaded 'C:\Windows\System32\AppXDeploymentClient.dll'. 
'tp2.exe' (Win32): Loaded 'C:\Windows\System32\Windows.ApplicationModel.dll'. 
\dev\WindowsAppRuntime_BootstrapDLL\MddBootstrap.cpp(814)\Microsoft.WindowsAppRuntime.Bootstrap.dll!00007FFA0C6CA677: (caller: 00007FFA0C6C8FEC) LogHr(3) tid(4248) 80040010 Object is not in any of the inplace active states
    Msg:[Bootstrap.Intitialize: Scanning packages for Major.Minor=1.3, Tag=, MinVersion=3000.820.152.0] CallContext:[\Initialize] 
Exception thrown at 0x00007FFA6127536C (KernelBase.dll) in tp2.exe: WinRT originate error - 0x80070491 : 'There was no match for the specified key in the index.'.
\dev\WindowsAppRuntime_BootstrapDLL\MddBootstrap.cpp(943)\Microsoft.WindowsAppRuntime.Bootstrap.dll!00007FFA0C6CB323: (caller: 00007FFA0C6C8FEC) Exception(1) tid(4248) 80070491 There was no match for the specified key in the index.
    Msg:[Enumeration: Major.Minor=1.3, Tag=, MinVersion=3000.820.152.0] CallContext:[\Initialize] 
Exception thrown at 0x00007FFA6127536C in tp2.exe: Microsoft C++ exception: wil::ResultException at memory location 0x0000003C1912AB30.
Exception thrown at 0x00007FFA6127536C in tp2.exe: Microsoft C++ exception: [rethrow] at memory location 0x0000000000000000.
\dev\WindowsAppRuntime_BootstrapDLL\MddBootstrap.cpp(213)\Microsoft.WindowsAppRuntime.Bootstrap.dll!00007FFA0C6DBFF1: (caller: 00007FFA0C6C71E9) ReturnHr(1) tid(4248) 80070491 There was no match for the specified key in the index.
    Msg:[\dev\WindowsAppRuntime_BootstrapDLL\MddBootstrap.cpp(943)\Microsoft.WindowsAppRuntime.Bootstrap.dll!00007FFA0C6CB323: (caller: 00007FFA0C6C8FEC) Exception(1) tid(4248) 80070491 There was no match for the specified key in the index.
    Msg:[Enumeration: Major.Minor=1.3, Tag=, MinVersion=3000.820.152.0] CallContext:[\Initialize] 
] CallContext:[\Initialize] 
\dev\WindowsAppRuntime_BootstrapDLL\MddBootstrap.cpp(166)\Microsoft.WindowsAppRuntime.Bootstrap.dll!00007FFA0C6C72E6: (caller: 00007FF97F7A9440) ReturnHr(2) tid(4248) 80070491 There was no match for the specified key in the index.
    CallContext:[\Initialize] 

解决方案

  • 完整保留发布目录结构:自包含部署依赖完整的文件层级,不能仅提取单个DLL。发布目录中的所有子文件夹(如runtimes、resources等)必须与主EXE、Bootstrap DLL放在同一目录,Bootstrap需要通过这些子目录定位对应版本的WinApp SDK组件。
  • 校验MddBootstrapInitialize参数:确保调用时传入的版本号(Major.Minor)、Tag、MinVersion与发布应用时使用的WinApp SDK版本完全匹配。日志显示扫描的是Major.Minor=1.3, MinVersion=3000.820.152.0,需确认自包含部署包包含对应版本的组件。
  • 确认自包含发布配置:在Visual Studio发布时,必须勾选“自包含”选项,且目标运行时、架构(x64/x86/arm64)与部署环境一致。若选择“依赖框架”,则不会生成完整的自包含依赖包。
  • 禁止手动拆分文件:直接使用发布目录的完整内容部署,不要手动提取单个文件。如需精简,可通过项目发布参数(如.NET项目的/p:TrimMode=Full)自动移除未使用的依赖,避免手动删除。
  • 修复资源文件加载问题:日志提示Failed to load resource string. id: 10001,需确保Microsoft.WindowsAppRuntime.Insights.Resource.dll与Bootstrap DLL在同一目录,且资源文件的语言、版本与Bootstrap匹配。

内容的提问来源于stack exchange,提问作者Michael Chourdakis

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.22 06:32:05