My question is: Do we have to do anything special when deploying a CLR Assembly to a 64-bit box when it has been compiled on a 32-bit box?Are there any advantages to setting the Target CPU from "AnyCPU" to "x64"?Documentation and testing seems to indicate that the assembly will run in 64-bit mode if compiled to "AnyCPU".
Will it run "better" in 64-bit mode with the "x64" Target CPU type?
Thanks!
There is nothing special you have to for assemblies to run on both 32-bit and 64-bit without any changes. You just need to be sure you have not made the assemblies architecture specific accidentally. By default, assemblies are MSIL unless the user specifies an architecture, runs ngen on them, or uses PInvoke.
To verify what architecture your assemblies are, do select * from sys.assemblies in your database, and look at the clr_name for the assembly. If you see processorarchitecture=msil or it is missing, then the assembly is architecture independent.
In your case, there is no advantage to specifing Target CPU as x64 because it will make deployment more complicated as you will have compile different assemblies for development and production. The "x64" Target CPU type is only useful if you were using PInvoke or some other CLR feature that made your binary architecture specific. The JIT will optimize the code just fine for each archiecture from the MSIL version.|||Thanks!
No comments:
Post a Comment