[Mono-list] Link against a DLL? (System.TypeLoadException)

Robert Jordan robertj at gmx.net
Mon May 23 06:53:44 EDT 2011


On 23.05.2011 08:58, Doug wrote:
> I'm having some trouble compiling a DLL and linking against it.
>
> Should be trivial, so I must be doing something wrong; I keep getting the
> error:
> ** (./a.out:27535): WARNING **: The class HelloLib.Hello could not be
> loaded, used in a, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
>
> Unhandled Exception: System.TypeLoadException: Could not load type
> 'HelloLib.Hello' from assembly 'a, Version=1.0.0.0, Culture=neutral,
> PublicKeyToken=null'.
>

> Compiles ok via:
> gmcs /debug- /target:library ./AssemblyInfo.cs ./hello.cs /out:a.dll
>

> Compiles ok via:
> gmcs /debug+ /warn:4 /reference:./a.dll ./main.cs /out:a.out
>
> ...
>
> But when I run it I get:
> ** (./a.out:27535): WARNING **: The class HelloLib.Hello could not be
> loaded, used in a, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
>
> Unhandled Exception: System.TypeLoadException: Could not load type
> 'HelloLib.Hello' from assembly 'a, Version=1.0.0.0, Culture=neutral,
> PublicKeyToken=null'.
>
> What am I doing wrong?
>
> Obviously this works fine:
> gmcs /debug+ /warn:4 ./hello.cs ./main.cs /out:a.out

You are creating two assemblies with the same base name "a".
Mono does not support this.

Robert



More information about the Mono-list mailing list