Can't reference Assemblies in GAC?

N

Nick

I've just created a simple class library, gave it a strong name using
sn.exe, then copied it to c:\winnt\assembly directory. I then created an
ASP client that reference that assembly. The client works only works if I
have the assembly under the ASP client's \bin directory, even though it's
also in GAC. Does anyone know what the problem is?

I got the following error:

File or assembly name <xxxx>, or one of its dependencies, was not found.

The assembly load trace does not seem to include the directory
"c:\winnt\assembly". Does it not always look for the assembly in GAC?

Thanks in advance.
Nick
 
S

SR

Hi

Try this out

a) Use th GACUtil utility to register in the GAC

b) more important(and believe me, many have had this
problem), is the way u are referrring to the GAC Assembly
in ur aspx. If u are just giving the assembly name, then
u need to have a copy of that assembly in ur bin dir. If
u want to access the GAC based assembly, then u need to
give the full identity(Name+Version+Culture+Public Key).

For example, while using Microsoft IE Web Controls,
If u refer it in ur aspx as
<%@ register TagPrefix="iewc"
Namespace="Microsoft.Web.UI.WebControls" Assembly
="Microsoft.Web.UI.WebControls" %>
and it forced me to have a local copy

U change it to
<%@ Register TagPrefix="iewc"
Namespace="Microsoft.Web.UI.WebControls"
Assembly="Microsoft.Web.UI.WebControls, Version=1.0.2.226,
Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>

and it will pick up perfectly from the GAC.

The reason is that to use any GAC based assembly u need to
provide the full identity

hope this helps

regards,

sr
 
N

Nick

Fixed. Thanks.

It looks like I had to copy the dll within the production server to GAC.
What I did before was coping the dll across the network.

Thank for the response.
Nick
 
G

Guru Prasad

Not sure if you got a response elsewhere. Anyways, an attempt will be made
to look in the GAC, only if you reference the assembly by the full name -
like so "MyCo.MyAssembly, Version=1.0.1175.28478,
Culture=neutral,PublicKeyToken=5378d68701e60agd"
If you have partial references and don't (cannot) want to change, you can
use qualifyAssembly element in Web.Config to redirect partial-name assembly
requests to full-name requests which then get redirected to GAC.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top