添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

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...

4.5+ AnyCPU is supposed to default to 32bit on x64 so the question is why is your 4.5 defaulting to x64 Alex K. Jan 30, 2014 at 17:07 Have you made sure that what you building is indeed AnyCPU? I know people who build x86 under AnyCPU and tell me that they do build AnyCPU. Make sure, from Config Manager to project config - everything is set to AnyCPU T.S. Jan 30, 2014 at 19:05 @n8wrl - I just look in the Task Manager. If there is a *32 next to the process, it is 32 bit. Check Scott Hanselmans blog for more: Richard.Davenport Jan 30, 2014 at 19:34 @Richard.Davenport I mean, there are clowns who set target x86 under AnyCpu configuration in project file. Then, they build solution with AnyCpu selected for that project and they think, they just built it for AnyCPU. You're right. I even wrote utility that I can use to determine assembly architecture without using corflags and when the code is IL it is indicator for any CPU T.S. Jan 30, 2014 at 19:56

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

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.

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.

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.

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.

In my projects in VS2013 the Platform target is "Any CPU" but the "Prefer 32 bit" is unchecked and GREYED OUT! n8wrl Jan 31, 2014 at 13:21

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question . Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers .