c# - x64 系统上的 x86 应用程序使用哪个 ngen?

标签 c# .net ngen

我决定问这个问题,因为没有找到明确的答案。我的 WPF 程序是 x86 (.Net 4.5.2)。我使用 Inno Setup 来安装和创建 ngen 镜像。我应该在 64 位系统上安装时使用 Microsoft.NET\Framework64\v4.0.30319\ngen.exe 在 32 位系统上安装时使用 Microsoft.NET\Framework\v4.0.30319\ngen.exe 还是因为程序是 x86 我应该一直使用Microsoft.NET\Framework\v4.0.30319\ngen.exe?

最佳答案

您只需从命令行运行 ngen.exe 即可轻松尝试。混合无法工作这一点非常清楚,对此非常很健谈。我将输出编辑为核心消息:

1>Ngen failed to generate native code for image C:\projects2\ConsoleApplication491\bin\Debug\ConsoleApplication491.exe because of the following error: The image file is not compatible with the version of Ngen you're running. Use 32bit Ngen for 32bit assemblies, and 64bit Ngen for 64bit assemblies. (Exception from HRESULT: 0x80131F07)

使用一个针对 x86 并运行 64 位版本的 ngen.exe 的小测试项目生成。

关于c# - x64 系统上的 x86 应用程序使用哪个 ngen?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28341629/

相关文章:

asp.net - 在 .NET 框架 SDK 风格的 web 项目中启动浏览器

c# - 如果需要,将方案添加到 URL

.net - 如何确定装配是否已被 ngen'd?

c# - 如何控制访问控制?

c# - WPF 中的异步任务

c# - .NET Native 和 Ngen.exe 有什么区别?

asp.net-mvc - 预编译 MVC Web 应用程序

c# - 应用程序似乎有两个 session cookie

c# - 仅显示 @Html.DisplayFor(model => model.fec_ini) 中的日期

c# - 是否可以将 C#11 'required' 修饰符用于 .NET Framework 4.8 和 .Net Standard 2.0?