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

Blazor MAUI桌面应用发布为.exe可执行文件时提示win-x64无效

你遇到的报错是因为Blazor MAUI Windows平台不支持无版本后缀的win-x64运行时标识符,必须使用匹配项目目标Windows SDK版本的带版本RID,具体解决步骤如下:

  • 打开项目根目录下的.csproj文件,在顶层<PropertyGroup>节点中添加如下配置(如果已有RuntimeIdentifiers节点直接修改内容即可),注意版本号要和你项目TargetFramework中的Windows SDK版本保持一致:
<RuntimeIdentifiers>win10.0.19041-x64;win10.0.19041-arm64</RuntimeIdentifiers>
<!-- 如需生成单EXE,追加以下配置 -->
<PublishSingleFile>true</PublishSingleFile>
<SelfContained>true</SelfContained>
<!-- 可选:裁剪程序集体积 -->
<PublishTrimmed>true</PublishTrimmed>
  • 重新进入发布流程,目标运行时选择你刚才配置的win10.0.19041-x64,不要选择普通的win-x64即可正常发布
  • 也可以直接使用命令行执行发布操作,命令示例:
    dotnet publish -f net6.0-windows10.0.19041 -r win10.0.19041-x64 -c Release

内容的提问来源于stack exchange,提问作者Jupiter rules

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.09.26 06:36:06