[Mono-list] Cannot find assembly `nunit.framework.dll'

A Rafael D Teixeira rafael.teixeirabr at terra.com.br
Wed Jun 7 13:03:14 EDT 2006


Hi Professor Boykin, comments inlined

On Wed, 2006-06-07 at 11:20 -0400, P. Oscar Boykin wrote:
> I am running Debian unstable with libnunit2.2.6-cil and mono 1.1.13.6.
> 
> I have nunit.framework.dll installed:
> 
> -rw-r--r-- 1 root root 29184 Apr 30
> 13:44 /usr/lib/mono/gac/nunit.framework/2.2.8.0__96d09a1eb7f44a77/nunit.framework.dll 
> 
> The GAC seems to know about it:
> 
> gacutil -l | grep nunit
> nunit.core, Version=2.2.8.0, Culture=neutral,
> PublicKeyToken=96d09a1eb7f44a77
> nunit.framework, Version=2.2.8.0, Culture=neutral,
> PublicKeyToken=96d09a1eb7f44a77
> nunit.util, Version=2.2.8.0, Culture=neutral,
> PublicKeyToken=96d09a1eb7f44a77
> 
> But when I try to compile a program using "-r: nunit.framework.dll" it
> does not work:
> 
> ===
> mcs -t:library *.cs -out:testout.dll -define:BRUNET_NUNIT -
> r:nunit.framework.dll
> error CS0006: Cannot find assembly `nunit.framework.dll'
> Log:
> 
> Compilation failed: 1 error(s), 0 warnings 
> ===
> If I by-pass the GAC, it works:
> 
> ===
> mcs -t:library *.cs -out:pob_test.dll -define:BRUNET_NUNIT -
> r:/usr/lib/mono/gac/nunit.framework/2.2.8.0__96d09a1eb7f44a77/nunit.framework.dll
> ConnectToMessage.cs (294,24): warning CS0219: The variable `ctm3a' is
> assigned but its value is never used
> ConnectionTable.cs(1121,26): warning CS0168: The variable `c' is
> declared but never used
> ConnectionTable.cs(1128,26): warning CS0168: The variable `c' is
> declared but never used 
> ConnectionTable.cs(1134,26): warning CS0168: The variable `c' is
> declared but never used
> Compilation succeeded - 4 warning(s)
> ===
> 
> Am I misunderstanding the role of the GAC?  

Surely yes. The GAC is a runtime-only repository for common managed
dlls.

> Shouldn't I be able to do -r: to reference assemblies there? 

No, you can't do that in .NET, and you can't do that (without that
hacked full GAC path). 

In VS.NET, for instance, when someone adds a "reference" to a library,
it has to navigate to an instance of its dll (not needed for the core
framework libs that IDE knows where to find), and the IDE copies the dll
to your project folder so that during compilation it can use that copy.
It boils down to an enforced policy to guarantee versioning, so that
side-by-side installation of multiple versions of the referenced library
is possible because they coexist peacefully.
> 
> Am I doing something incorrectly?

You need to have the original non-GACed dll somewhere you can point to
in the command line, or where the compiler automatically looks for it:
in the current dir or in the dir that contains the compiler and core
framework libraries.

Nunit libs, when correctly installed, are normally copied to where mono
core libs live and then GACed. (Our GAC implementation moves it to its
own directories and leave a symbolic link in the original place, except
on Windows that lacks symlinks, where I believe a copy is made instead
of a move).

If the Nunit package (I'm thinking about the one Mono packages) was
installed to a different prefix than Mono, the libs can't be
automatically found by the compiler, and a full path (not the GAC one)
must be given in the compiler command line or the libs need to be copied
to the directory where the compilation is taking place.

:)

> -- 
> P. Oscar Boykin                            http://boykin.acis.ufl.edu
> Assistant Professor, Department of Electrical and Computer
> Engineering 
> University of Florida 

Hope it helps,

-- 
Rafael "Monoman" Teixeira 
Mono Hacker since 16 Jul 2001 - http://www.mono-project.com/
Mono Brasil Founding Member - http://monobrasil.softwarelivre.org/
Simios Proud Member - http://www.simios.org/ 
English Blog: http://thespoke.net/blogs/monoman/default.aspx
Brazilian Portuguese Blog: http://www.simios.org/blog/monoman



More information about the Mono-list mailing list