Target 4.5.1 和 Any CPU 在 x64 上以 32 位运行,4.5 以 64 位运行,为什么? [英] Target 4.5.1 and Any CPU runs as 32 bit on x64, 4.5 runs as 64 bit, Why?

查看:23
本文介绍了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 位运行,为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆