[Mono-list] Not all types imported from linked assemblies

Stephen Touset stephen@touset.org
Tue, 9 Nov 2004 16:15:28 -0500 (EST)


I've run into a bit of a problem trying to use the mcs compiler. I'm using
MonoDevelop as my IDE, but I've attempted to do the same steps through the
command line, both to no fruition.

Essentially, I have two projects: one as a main development project, the
other  as a side project used for compiling unit tests and running them
(based off the NUnit assembly) and running them. Obviously, I need to link
in the classes from the base .NET project in order to run the unit tests
against them. MonoDevelop's way of doing this is to depend on the base
project, then run:

mcs -target:library -out:outfile.dll ${SOURCES} -r:${BASE_PROJECT_EXE}
-r:${OTHER_ASSEMBLIES}

Since this links against the base project's .exe, this makes classes from
the base project visible to the unit testing library. However, I right now
have two classes in the base project that I want to test, and the above
command only works for one of them. I've isolated them to clarify my
point.

$ mcs -target:library -out:"test.dll" -r ../LADR.exe -r
nunit.framework.dll Sources/Record/Record_Test.cs
Compilation succeeded
$

$ mcs -target:library -out:"test.dll" -r ../LADR.exe -r
nunit.framework.dll Sources/Record/LdapRecordProxy_Test.cs
Sources/Record/LdapRecordProxy_Test.cs(6) error CS0246: Cannot find type
`LdapRecordProxy'
Compilation failed: 1 error(s), 0 warnings
$

However, a quick "strings" shows that the assembly has both classes in place:

$ strings ../LADR.exe | grep Record
IRecord
LdapRecordProxy
Record
$

I could always include the sources from the base project by hand, but that
defeats MonoDevelop's nice project integration. Also, I'm sure I'm just
doing something obvious wrong, since one of the classes is being found
easily, but the other is not. Does anyone have a possible solution?

-- 
Stephen Touset <stephen@touset.org>