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

Apple Silicon设备Rider运行IdentityServer项目遇FileLoadException求助

针对Apple Silicon设备Rider中IdentityServer MVC项目的FileLoadException解决方案

1. 强制指定项目运行架构

Apple Silicon为arm64架构,项目默认加载逻辑可能适配x64程序集导致失败:

  • 打开Rider右上角运行按钮下拉菜单,选择Edit Configurations
  • 找到目标MVC项目配置,进入Configuration标签页,将Platform target设置为ARM64或Any CPU(注意取消勾选Prefer 32-bit选项)
  • 保存配置后重新运行项目

2. 检查NuGet包架构兼容性

  • 打开项目.csproj文件,确认IdentityServer相关包版本支持arm64(比如IdentityServer4 4.1.0+、Duende IdentityServer稳定版)
  • 在.csproj中添加以下属性,强制NuGet下载兼容架构的包:
    <PropertyGroup>
      <RuntimeIdentifiers>osx-arm64;win-x64</RuntimeIdentifiers>
    </PropertyGroup>
    
  • 执行dotnet restore命令重新还原依赖

3. 调整Rider运行时设置

  • 打开Rider设置(快捷键⌘+,),进入Build, Execution, Deployment > Toolset and Build
  • 在MSBuild version中选择arm64版本的MSBuild(路径类似/usr/local/share/dotnet/sdk/[你的SDK版本]/MSBuild.dll,确保本地安装的是arm64版.NET SDK)
  • 关闭Rider后删除项目根目录的.idea文件夹,重新打开项目

4. 清理.NET运行时缓存

  • 打开终端执行以下命令清理全局缓存:
    dotnet nuget locals all --clear
    
  • 依次执行dotnet clean、dotnet restore、dotnet build命令后再尝试运行项目

5. 检查自定义IdentityServer程序集(若有)

如果项目引用的是自定义编译的IdentityServer程序集而非NuGet包:

  • 找到该程序集的源码项目,将其Platform target设置为ARM64重新编译
  • 替换MVC项目中对应的引用程序集

内容的提问来源于stack exchange,提问作者Oleksandr Svyrydov

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.16 07:07:34