Target 4.5.1 和 Any CPU 在 x64 上以 32 位运行,4.5 以 64 位运行,为什么?

编程入门 行业动态 更新时间:2024-10-28 20:29:37
本文介绍了Target 4.5.1 和 Any CPU 在 x64 上以 32 位运行,4.5 以 64 位运行,为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

Visual Studio 目标 4.5.1 和任何 CPU 在 x64 上以 32 位运行,但是当目标 4.5 和任何 CPU 时,它将在 x64 系统上以 64 位运行.4.5.1 有什么变化让它在 WOW 模式下运行?

Visual Studio target 4.5.1 and Any CPU runs as 32 bit on x64, but when targeting 4.5 and Any CPU it will run as 64 bit on x64 system. What has changed in 4.5.1 to make it run in WOW mode?

希望这是有道理的...

Hope this makes sense...

推荐答案

.NET 4.5.1 中没有任何更改会影响进程的位数.

Nothing changed in .NET 4.5.1 that affects the bitness of the process.

一个很常见的陷阱是程序员过于关注平台名称.例如,突出显示在构建 + 配置管理器"对话框中.该名称与托管项目无关.它只对根据平台选择生成不同代码的项目类型很重要.C++ 项目.

A very common trap is that programmers pay too much attention to the Platform name. Prominently displayed in the Build + Configuration Manager dialog for example. The name is irrelevant for managed projects. It only matters to the kind of projects that generate code differently based on the Platform selection. C++ projects.

更糟糕的是,不同 VS 版本之间的默认平台名称发生了变化.它一直是 AnyCPU.然后在VS2010中改为x86.这引起了巨大的混乱,因此在 VS2012 中将其改回 AnyCPU.

What's worse is that the default Platform name changed between different VS versions. It always used to be AnyCPU. Then it was changed to x86 in VS2010. That caused massive confusion so it was changed back to AnyCPU in VS2012.

有效果的真实设置位于 C# IDE 的项目 + 属性"、构建"选项卡、平台目标"设置中.对于 VS2012 及更高版本,还有首选 32 位"复选框.仅对于 EXE 项目,它首先运行并锁定位数.如果您选择 x86(或勾选框),则指示 CLR 使用 x86 抖动而不是 x64 抖动.

The real setting that has an effect is in Project + Properties, Build tab, Platform target setting for the C# IDE. For VS2012 and up also the "Prefer 32-bit" checkbox. Only for the EXE project, it runs first and locks-in the bitness. If you pick x86 (or tick the box) then the CLR is instructed to use the x86 jitter instead of the x64 jitter.

默认情况下,新项目的首选 32 位"复选框处于启用状态.因此,您已经自动发现 AnyCPU 的平台名称与正在运行的进程的实际位数不匹配.哦,快乐.

The "Prefer 32-bit" checkbox is turned on by default for a new project. So you already automatically have a mismatch between the Platform name of AnyCPU and the actual bitness of the running process. Oh joy.

更多推荐

Target 4.5.1 和 Any CPU 在 x64 上以 32 位运行,4.5 以 64 位运行,为什么?

本文发布于:2023-11-04 17:18:34,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1558546.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:上以   CPU   Target

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!