GAC and FileNotFoundException Can someone help?

  • Thread starter Thread starter Prodip Saha
  • Start date Start date
P

Prodip Saha

I am trying to load a shared component like DataAccess from GAC and not been
able to successfully get it working for my asp.net application. The dll is
loading from the GAC with correct version and I can verify it from Output
window of VS.Net IDE. I can change the policy and it works because I can see
the oldversion is redirected to newVersion.

The problem is- unless I copy the dll in the bin directory of the
application [from where it referenced by other components of the
application] I get FileNotFoundException. This entirely defeats the purpose
of have the dll in the GAC.

I have tried the codebase but asp.net always probes the dll in the temporary
directory like the one below-
Attempting download of new URL
file:///C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET
Files/iisvirtualpathname/c6b755e3/7450c22c/DataAccess.DLL ...etc.

So, my question is why am I getting the file not found exception while the
file is already loaded from GAC? Am I missing something? I would appreciate
your comments.

Thanks,
Prodip Saha
 
you need to tell asp.net compiler where to find the assembly. in the
compilation section of the web config add:

<add assembly="<AssemblyFileName>, Version=0.0.0.0, Culture=neutral,
PublicKeyToken=<keyvalue>" />


-- bruce (sqlwork.com)
 
Just wanted to add one comment- application is built with a reference to
non-strong named version of the same dll. I mean the assembly menifest of
the ParentAssembly does not have a publickeytoken defined for the Dependent
assembly. Example-

//ildasm.exe>open>ParentAssembly.dll >manifest
..assembly extern System.Data
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) //
.ver 1:0:5000:0
}
..assembly extern Data.Access
{
.ver 1:0:1502:29024 //publickeytoken is not there because I
did not recompile the ParentAssembly.dll
}

I applied the strong name and installed in the GAC at a later time. Does
this make any difference?

Thanks,
Prodip
 
Scott,
Yes, Local Copy is set to False.

Thanks,
Prodip

Scott M. said:
Have you set the "Copy Local" property of the assembly reference to False?


Prodip Saha said:
I am trying to load a shared component like DataAccess from GAC and not
been
able to successfully get it working for my asp.net application. The dll is
loading from the GAC with correct version and I can verify it from Output
window of VS.Net IDE. I can change the policy and it works because I can
see
the oldversion is redirected to newVersion.

The problem is- unless I copy the dll in the bin directory of the
application [from where it referenced by other components of the
application] I get FileNotFoundException. This entirely defeats the
purpose
of have the dll in the GAC.

I have tried the codebase but asp.net always probes the dll in the
temporary
directory like the one below-
Attempting download of new URL
file:///C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET
Files/iisvirtualpathname/c6b755e3/7450c22c/DataAccess.DLL ...etc.

So, my question is why am I getting the file not found exception while the
file is already loaded from GAC? Am I missing something? I would
appreciate
your comments.

Thanks,
Prodip Saha
 
Bruce,
I have tried it but it did not help-

<assemblies>
<add
assembly="Data.Access,Version=1.0.1902.19083,Culture=neutral,PublicKeyToken=
afe57206630e2fsd" />
<add
assembly="Interface.Data.Access,Version=1.0.1902.19082,Culture=neutral,Publi
cKeyToken=afe57206630e2fsd" />
</assemblies>

Will be taking your answer. Thanks.
Prodip

Bruce Barker said:
you need to tell asp.net compiler where to find the assembly. in the
compilation section of the web config add:

<add assembly="<AssemblyFileName>, Version=0.0.0.0, Culture=neutral,
PublicKeyToken=<keyvalue>" />


-- bruce (sqlwork.com)


Prodip Saha said:
I am trying to load a shared component like DataAccess from GAC and not
been
able to successfully get it working for my asp.net application. The dll is
loading from the GAC with correct version and I can verify it from Output
window of VS.Net IDE. I can change the policy and it works because I can
see
the oldversion is redirected to newVersion.

The problem is- unless I copy the dll in the bin directory of the
application [from where it referenced by other components of the
application] I get FileNotFoundException. This entirely defeats the
purpose
of have the dll in the GAC.

I have tried the codebase but asp.net always probes the dll in the
temporary
directory like the one below-
Attempting download of new URL
file:///C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET
Files/iisvirtualpathname/c6b755e3/7450c22c/DataAccess.DLL ...etc.

So, my question is why am I getting the file not found exception while the
file is already loaded from GAC? Am I missing something? I would
appreciate
your comments.

Thanks,
Prodip Saha
 
Just to let you all know that I got it resolved. My fear came true. I had to
rebuild all the components (used by the app) with the strong named version
of the dataaccess dll and all works fine. I don't have to copy dll in the
bin directory anymore. The dll can be in the bin directory during the
development time just for adding references. However, the framework will use
the one from the GAC.

Thanks you all for contributing to this thread.

Prodip
 
Can you provide a littme more detail. May be the actual exception itself.

Thanks
NitRaGs
 
Back
Top