Visual-studio – Visual Studio reference x64 GAC

64-bitvisual studio

How can one get Visual Studio 2005/2008 to reference assemblies in the 64-bit GAC instead of the 32-bit GAC? We are settin the target platfom to x64 and the compiler is throwing the error of

Error 2 Warning as Error: Assembly generation — Referenced assembly 'System.Data.dll' targets a different processor Common

Error 3 Warning as Error: Assembly generation — Referenced assembly 'mscorlib.dll'
targets a different processor Common

Error 4 Assembly signing failed; output may not be signed — The system cannot find the file specified. Common


Update 29 Dec 08

Been trying out Aaron Stebner's suggestions to place 64-bit assemblies onto an isolated location (e.g. C:\Windows\Microsoft.NET\Framework64\v2.0.50727\GAC_64) and creating additional entries in the registry like HKLM\SOFTWARE\Microsoft.NETFramework\AssemblyFolders\GAC_64 or HKLM\SOFTWARE\Microsoft.NETFramework\v2.0.50727\AssemblyFoldersEx\GAC_64 but Visual Studio 2005 is still not picking it up….

Best Answer

I'm not sure why you would need to do this. .NET code that isn't specifically compiled for 32 bit will run 64 bit if it can. This includes the base framework libraries. In short, there is no reason that I know of to compile your assemblies specifically for 64 bit (other than referencing unmanaged 64 bit dlls, but you're talking about the GAC).

Some more information might help here.