views:

973

answers:

5

Is there any way to force my asp.net application to load the assembly from local bin directory since there is another older version of the assembly with the same name in the gac?

I can't delete the gac version since other applications are using it and I am facing some difficulties when adding the newer version to the gac.

+1  A: 

Strong name the assembly and reference the strongly named version you deploy with your solution.

Wyatt Barnett
I try it but it also loads the assembly from the gac
Khaled Musaied
Forgot to add the "change version number" step. Then you should be golden.
Wyatt Barnett
A: 

How does your application load this Assembly? Did you make direct reference via "Browse"?

murad
I am referencing the project but in the production the old assembly is deployed to the gac
Khaled Musaied
+1  A: 

I found it

To force your application to read from local bin directory you have to remove signing from your assembly and then the application will load the assembly from bin.

Thanks Wyatt Barnett and murad.

Khaled Musaied
What if I can't remove the strong name from the assembly?
Amitabh
A: 

Why not install the version that you like into the GAC and then reference it in the GAC?

Matthew
A: 

Hi Khaled,

To redirect one version to another, use the element. The oldVersion attribute can specify either a single version, or a range of versions. For example, specifies that the runtime should use version 2.0.0.0 instead of the assembly versions between 1.1.0.0 and 1.2.0.0.

Muse VSExtensions
Where can I find this oldVersion attribute?
Khaled Musaied