Re: GAC entries don't show up in References/.NET

From: Abubakar (emailallrise_at_yahoo.com)
Date: 02/10/05


Date: Thu, 10 Feb 2005 17:20:47 +0500


> I put the 2nd dll in the \winnt\system32 directory.
this is another location where the search is done

> And also, it would mean that a strongly named dll, registered in the
> GAC, cannot be called by another dll.
>
> I'd really like someone from Microsoft to prove me wrong on this, as I
> suspect is a very major bug in the .NET assembly configuration
> management(!)
ok so now i had to do an experiment, prepare a code and upload it for your
convenience. I'll give u a simple experiment to do now with assemblies built
by me.
Download the files from here http://www.geocities.com/abubakar021/help.zip.
Extract the files and you'll find a folder named "runfromGAC". It has a
ConsoleApplication1.exe and 2 folders named d1 and d2. Check this:
ConsoleApplication1.exe calls dll1 which calls dll2. Now notice this that
you only have ConsoleApplication1.exe in the root folder and there is no dll
there, so ConsoleApplication1.exe does NOT know where its dependencies are
located which I'm going to demo you. Open a command prompt and browse to the
dir where your ConsoleApplication1.exe is and run it by typing
"ConsoleApplication1.exe" on the command prompt (without quotes of course).
You'll receieve the following error:

+++++++++++++++++++
Unhandled Exception: System.IO.FileNotFoundException: File or assembly name
ClassLibrary1, or one of its dependenci
es, was not found.
File name: "ClassLibrary1"
   at ConsoleApplication1.Class1.Main(String[] args)

=== Pre-bind state information ===
LOG: DisplayName = ClassLibrary1, Version=1.0.1867.29218, Culture=neutral,
PublicKeyToken=59c3da0b75007a93
 (Fully-specified)
LOG: Appbase = D:\tempcode\experiment\Run\runfromGAC\
LOG: Initial PrivatePath = NULL
Calling assembly : ConsoleApplication1, Version=1.0.1867.29219,
Culture=neutral, PublicKeyToken=null.
===

LOG: Application configuration file does not exist.
LOG: Publisher policy file is not found.
LOG: Host configuration file not found.
LOG: Using machine configuration file from
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\config\machine.config.
LOG: Post-policy reference: ClassLibrary1, Version=1.0.1867.29218,
Culture=neutral, PublicKeyToken=59c3da0b75007a93

LOG: Attempting download of new URL
file:///D:/tempcode/experiment/Run/runfromGAC/ClassLibrary1.DLL.
LOG: Attempting download of new URL
file:///D:/tempcode/experiment/Run/runfromGAC/ClassLibrary1/ClassLibrary1.DL
L.
LOG: Attempting download of new URL
file:///D:/tempcode/experiment/Run/runfromGAC/ClassLibrary1.EXE.
LOG: Attempting download of new URL
file:///D:/tempcode/experiment/Run/runfromGAC/ClassLibrary1/ClassLibrary1.EX
E.
+++++++++++++++++++
NOTE: the paths before "runfromGAC" are my machine specific, they'll be diff
on yours.

Read the error, its clear that the class lib 1 is missing. If we register it
this error should go away right? So thats what we r going to do. Now goto
your Control Panel->Administrative Tools. Double click the "Microsoft .NET
Framework 1.1 Configuration". Right click the "Assembly Cache" node and
click "Add ...". Locate the dll1 from "d1" folder and click "Open" and now
the ClassLibrary1.dll is in gac. Now back to command prompt. run the
ConsoleApplication1.exe again. Now you see a similar error as before but its
not the same. Notice now its the following:
+++++++++++++++
Unhandled Exception: System.IO.FileNotFoundException: File or assembly name
ClassLibrary2, or one of its dependenci
es, was not found.
File name: "ClassLibrary2"
   at ClassLibrary1.Class1.getCL2data()
   at ConsoleApplication1.Class1.Main(String[] args)

=== Pre-bind state information ===
LOG: DisplayName = ClassLibrary2, Version=1.0.1867.29085, Culture=neutral,
PublicKeyToken=3727e4d9d6b9561c
 (Fully-specified)
LOG: Appbase = D:\tempcode\experiment\Run\runfromGAC\
LOG: Initial PrivatePath = NULL
Calling assembly : ClassLibrary1, Version=1.0.1867.29218, Culture=neutral,
PublicKeyToken=59c3da0b75007a93.
===

LOG: Publisher policy file is not found.
LOG: Host configuration file not found.
LOG: Using machine configuration file from
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\config\machine.config.
LOG: Post-policy reference: ClassLibrary2, Version=1.0.1867.29085,
Culture=neutral, PublicKeyToken=3727e4d9d6b9561c

LOG: Attempting download of new URL
file:///D:/tempcode/experiment/Run/runfromGAC/ClassLibrary2.DLL.
LOG: Attempting download of new URL
file:///D:/tempcode/experiment/Run/runfromGAC/ClassLibrary2/ClassLibrary2.DL
L.
LOG: Attempting download of new URL
file:///D:/tempcode/experiment/Run/runfromGAC/ClassLibrary2.EXE.
LOG: Attempting download of new URL
file:///D:/tempcode/experiment/Run/runfromGAC/ClassLibrary2/ClassLibrary2.EX
E.
+++++++++++++++
NOTE: the paths before "runfromGAC" are my machine specific, they'll be diff
on yours.

The situation now is that the ClassLibrary1.dll has been located by
ConsoleApplication1 (thanks to gac), but now the ClassLibrary1.dll cannot
locate its dependency which is ClassLibrary2.dll. So now if we just register
the ClassLibrary2.dll this error should also go away and execution of
ConsoleApplication1 should be smooth. So go ahead and register the
ClassLibrary2.dll (which u'll find inside the d2 folder) the same way you
did ClassLibrary1.dll. Once u r done registering the ClassLibrary2.dll with
the "Microsoft .NET Framework 1.1 Configuration", you can now run
ConsoleApplication1 and it'll give the following output:

value is dll2 value.

One of the files inside the zip file that you'll download is in "rar" format
and you can open it using the WinRar which you can get from
www.downloads.com.

I really hope that helps :-)

Ab.
http://joehacker.blogspot.com.

"Ricola !" <semolina.pilchards@tower.effeil> wrote in message
news:420A8677.50901@tower.effeil...
>
> Ok, I found a fix...I thought about it while riding my bicycle to
> Tully's to get a coffee.
>
> I put the 2nd dll in the \winnt\system32 directory.
>
> So, for some reason, when a dll calls a 2nd dll.
>
> My theory is that when a dll "runs", it's actually running in
> \winnt\system32
>
> And also, it would mean that a strongly named dll, registered in the
> GAC, cannot be called by another dll.
>
> I'd really like someone from Microsoft to prove me wrong on this, as I
> suspect is a very major bug in the .NET assembly configuration
> management(!)
>
>
> Ricola ! wrote:
> > Abubakar wrote:
> >
> >> I also maybe missing something as I havnt ever made a windows service
> >> and
> >> deployed it. I cannot think of any other situation why your dlls are
not
> >> getting located. Maybe versioning would be a problem but I'm not sure
> >> about
> >> that. But try a little exercise to be sure that what u r doing is
right.
> >> Simply make 2 dlls (.net dlls) where dll1 uses some function of dll2.
Now
> >> create an exe (windows forms or console) and call some function of the
> >> dll1
> >> (which calls dll2). now deploy these assemblies in your XP machine ( I
> >> assume that you would be using that win2k machine as dev machine).
Things
> >> should work.
> >
> >
> > That describes exactly what I'm doing.
> >
> > The results are ( and I use your names for the sake of readability ):
> >
> > On the <b>XP</b> machine ( development workstation ) it runs fine --
> > even if I completely shut down studio and run it normally.
> >
> > myExe calls dll1 which calls dll2
> >
> > myEexe is located in \program files\myExe
> >
> > dll1 and dll2 are located in \program files\myDLLs
> >
> > dll1 and dll2 have strong names and are registered in the GAC
> >
> > However, when I move this structure to a target <b>w2k</b> server, dll1
> > fails to find dll2, generating the error:
> >
> > 2/8/2005 6:56:01 PM: CS0006: Metadata file 'dll2' could not be found
> >
> >
> > I have searched and deleted all extra copies of myExe, dll1 and dll2 on
> > both machines.
> >
>
>
> --
> Texeme Textcasting Technology
> http://texeme.com
>
> Indie Pop Rocks @ SomaFM
> http://somafm.com/
>



Relevant Pages

  • Re: GAC entries dont show up in References/.NET
    ... cannot be called by another dll. ... Download the files from here http://www.geocities.com/abubakar021/help.zip. ... ClassLibrary1, ... Application configuration file does not exist. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: GAC entries dont show up in References/.NET
    ... When I get to work today, I will download and try this in w2k to see if I ... cannot be called by another dll. ... Application configuration file does not exist. ... If we register ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: GAC entries dont show up in References/.NET
    ... When I get to work today, I will download and try this in w2k to see if I ... cannot be called by another dll. ... Application configuration file does not exist. ... If we register ...
    (microsoft.public.dotnet.general)
  • VS2005 Whidbey Beta 1 FileLoadException when loading assembly
    ... This DLL builds fine. ... Assembly manager loaded from: ... No application configuration file found. ... Attempting download of new URL ...
    (microsoft.public.dotnet.general)
  • >>> DLL DOWNLOAD <<<
    ... download pcsx2 gsdx dll d3d ... download windows dll files ... dll file downloads ...
    (sci.astro)

Quantcast