views:

2681

answers:

4

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....

A: 

Have you set x64 platform for all projects in your solution in Configuration Manager ?

Shrike
Yes but it does not matter. It is the BCL assemblies that the projects are referencing like System.Data.dll and mscorlib.dll. They are referncing the assemblies in the 32-bit GAC. Would be nice to have the option to reference the 64-bit GAC instead.
icelava
+1  A: 

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.

sliderhouserules
Yes we are compiling our application to specifically target x64. And because of that the compiler complains System.Data or mscorlib are targetting x86.....
icelava
Have you redone the afflicted references after changing the compile target in project properties?
sliderhouserules
A: 

I am trying to reference unmanaged 64 bit dlls for developers on 64 bit machines and unmanged 32 bit assemblies for everyone else. Is there a way to make that work automagically so the 64 bit rigs don't have to manually update their references every time they get latest?

Thank you!

PeteK
In the Stackoverflow site, Answers should be focused on the original question topic. They do not fit in like regular threads in traditional forums. You ought to open your own question to attract answers dedicated to your scenario.
icelava
A: 

Hi,

I've created a tool which is completely free, that will help you to achieve your goal. Muse VSReferences will allow you to add a Global Assembly Cache reference to the project from Add GAC Reference menu item.

Hope this helps Muse VSExtensions

Muse VSExtensions