I've got 开发者_如何学运维a windows service compiled as AnyCPU. I'm trying to get it into our installer to distribute. However... I am unclear on the difference between the 32 bit and 64 bit versions of InstallUtil. Does anyone know what (if any) there are?
On my 64 bit machine, I can run either the $(WinDir)\Microsoft.NET\Framework64\v2.0.50727 or the $(WinDir)\Microsoft.NET\Framework\v2.0.50727.
In both cases, the resulting service Process in Task Manager does not have the *32 flag applied to it.
Only the 32 bit InstallUtil works on 32 bit machines (obviously).
Is there a need to use the \Framework64\ version of InstallUtil? What does it do differently?
According to this, you are supposed to use the 64 bit version to install 64-bit and MSIL assemblies, but it doesn't say why.
Starting with the .NET Framework version 2.0, the 32-bit version of the common language runtime (CLR) ships with only the 32-bit version of the Installer tool, but the 64-bit version of the CLR ships with both 32-bit and 64-bit versions of the Installer tool. When using the 64-bit CLR, use the 32-bit Installer tool to install 32-bit assemblies, and the 64-bit Installer tool to install 64-bit and Microsoft intermediate language (MSIL) assemblies. Both versions of the Installer tool behave the same.
I believe here explains why. If you look at the bottom of the post, it explains some differences between the two and when to use the 32-bit intallutil.
Installutil.exe is built for a specific platform, therefore it will start as a 32 or 64-bit process and the related registry hive will be updated. Note that if you have a snap-in built with the platform switch, you will only be able to register it in one of the hives (32-bit or 64-bit).
I ran across this as well. The issue was my VS2008 project was set to Platform Target: Any CPU. No matter which InstallUtil.exe (32 or 64) I ran on the 64 bit OS it was installing as 64 bit.
I changed my project setting Target to x86 and then ran the 32 bit installutil.exe and everything works fine. It now shows the *32 flag in Task Manager.
If you're installing a 64-bit only assembly, the 32-bit InstallUtil won't be able to load it. You'll need to use the 64-bit version.
精彩评论