Reputation: 117240
TLDR: When installing .NET on a 64-bit OS, are the 32-bit components always present?
I used to have my app (IronScheme) compiled entirely as AnyCPU
. While this works great for all platforms, the 64-bit JIT compiler just seems too slow for my liking (about 550% slower startup and about 25% slower in general). The startup slowness can be solved by NGEN'ng my assemblies and does in fact improve startup time another odd 500% when done so. This is gives about a 2600% improvement on startup time (3700ms vs 140ms) on 64-bit. When both 32-bit and 64-bit are NGEN'd, the startup times are the same, but 32-bit still performs better at runtime.
Now given in most cases 64-bit is not needed at all, I think targeting x86 in the executable would just be the best general solution (all the other assemblies are targeting AnyCPU
, but from what I can see, the executable determines where it goes). So the idea is to to have 2 startup executables, one targeting x86, the other x64 (or amd64 as MS calls it).
When installing on a 32-bit OS, I can be sure no 64-bit components are present. But what about the opposite case? Does the .NET installer install both 32-bit and 64-bit components? This is important as NGEN'ng a non-AnyCPU assembly will fail if the target does not match the runtime.
Example:
"Error compiling IronScheme.Console.exe: This version of is not compatible with the version of Windows you're running."
Also note that my application is built by default for .NET 2 and in VS2008, so the new AnyCPU (32-bit preferred)
option (in VS2012/.NET 4.5) is not an option for me at this time.
PS: Sorry, if this has been asked before. I have no idea how to search for this specific issue, and my Google fu failed me too.
Upvotes: 6
Views: 380
Reputation: 141638
are the 32-bit components always present on a 64-bit OS?
No. But the case that it isn't installed is somewhat rare. Windows Server Core 2008 R2 (and presumably Core 2012) support WOW64 as a separate, installable, and removable component - including the .NET bits. Take a look here for a little more information.
In order to install the WOW64 components for Server Core 2008 R2 this needs to be run:
Start /w ocsetup NetFx3-ServerCore-WOW64
Server Core is the only case I have been able to find where the x64 components may be available, but the x86 ones may not be. If you are not targeting or supporting Server Core, then I believe it is safe to assume the x86 bits will be there along side with the x64 bits.
Upvotes: 5