Why is the default platform platform for WPF applications in Visual Studio x86 and not AnyCPU?

When I create a new WPF application in Visual Studio 2012, the target platform and platform build configuration is set to x86 by default. Why is this so? For a simple WPF application (without any references to mixed-mode assemblies), is there any danger using AnyCPU, so my WPF executable will be JITed for x64 code on my x64 machine and x86 on x86 machine?

+7
source share
3 answers

Why is this so?

For most applications, creating 32bit is actually better. 64bit provides several advantages and some significant disadvantages in most cases (much higher memory usage, more complex dependency management with multiple platforms, worse debugging experience, etc.).

If, however, your application should be able to use large amounts of memory, then, of course, 64-bit ones have advantages (and they can easily be switched to VS), but most applications do not fall into this boat.

This is why the new standard in VS 2012 should use AnyCPUPrefer32Bit instead of AnyCPU for applications.

+5
source

According to this post, this was done due to problems with Edit and Continue on x64 machines with x64 code. Changing it to x86, Edit and Continue work correctly.

There should be no danger when switching to AnyCPU. I always do that.

+2
source

If you decide to specify a processor, then you automatically limit your .exe to one platform or another.

It rarely happens if you do not have 32-bit dependencies:

In other words, there is no "performance" problem. The real problem is compatibility. If you download any 32-bit components and you use a 64-bit platform, you must call WOW64. CLRTIMAGETYPE allows you to do this.

0
source

All Articles