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

如何在JetBrains Rider中构建exe文件?Mac开发.NET Framework遇问题

解决Mac上Rider生成.NET Framework Windows exe的问题

你需要针对Windows平台指定目标运行时和架构,才能生成Windows可执行文件,具体步骤如下:

  • 确认项目输出类型
    右键项目→Properties→Application,确保Output type是「Console Application」(控制台应用程序),而非Class Library(类库)。

  • 配置目标运行时与架构

    1. 编辑项目的.csproj文件,添加指定Windows目标的配置:
      <PropertyGroup>
        <!-- 若需32位Windows可执行文件,改为win-x86 -->
        <RuntimeIdentifier>win-x64</RuntimeIdentifier>
        <PlatformTarget>x64</PlatformTarget>
      </PropertyGroup>
      
    2. 或者在Rider的项目属性→Build选项卡中,设置Platform target为x64或x86,再在高级构建设置里指定Runtime为win-x64/win-x86。
  • 使用指定参数构建
    在终端进入项目目录,执行以下命令强制构建Windows目标:

    msbuild /p:Configuration=Release /p:Platform=x64 /p:RuntimeIdentifier=win-x64
    

    构建完成后,Windows exe文件会生成在bin/Release/net[你的框架版本]/win-x64/目录下。

  • 检查Rider构建配置
    从你提供的截图看,当前Platform是Any CPU,需要改为x64/x86,并确保Runtime配置指向Windows平台,避免默认生成Mac本地二进制文件。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.19 02:05:09