[Mono-list] Assembly with 2 versions in GAC

Julien Sobrier julien at sobrier.net
Thu Nov 3 23:42:59 EST 2005


Julien Sobrier wrote:
> Hello,
> I have an issue with different version of assemblies being in the GAC:
> /mnt/hgfs/platine/branches/jsobrier/platine/NUnit/Libraries/TestDatabaseAccess.cs(288,16):
> The type IDataReader has two conflicting definitions, one comes from
> System.Data, Version=1.0.5000.0, Culture=neutral,
> PublicKeyToken=b77a5c561934e089 and the other from System.Data,
> Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089error
> 
> (NAnt output)
> 
>>From what I read, this can be solved by adding the right information in
> TestDatabaseAccess.dll.config file. Is it possible to do it at
> compilation time? I'm surprised that it doesn't pick the version it was
> compiled with (I compiled it with the 2.0.0.0 version)
> 
> Thank you
> Julien

I have more details.

I using NAnt,but I don think it is part of the problems. I create 2
assemblies that use System.Data et Mono.Data.SqliteClient:

<csc target="library" output="${dir}/Database.dll">
    <sources>
        <include name="Libraries/Database/*.cs" />
    </sources>
    <references>
        <include asis="true" name="/usr/lib/mono/2.0/System.Data.dll" />
        <include asis="true"
name="/usr/lib/mono/2.0/Mono.Data.SqliteClient.dll" />
    </references>
</csc>

<csc target="library" output="${tests.dir}/TestDatabaseAccess.dll">
    <sources>
        <include name="NUnit/Libraries/TestDatabaseAccess.cs" />
    </sources>
    <references>
        <include asis="true" name="${tests.dir}/Database.dll" />
        <include asis="true" name="/usr/lib/mono/1.0/log4net.dll" />
        <include asis="true" name="/usr/lib/mono/2.0/System.Data.dll" />
        <include asis="true"
name="/usr/lib/mono/2.0/Mono.Data.SqliteClient.dll" />
    </references>
</csc>


Database.dll compiles just fine. but note TestDatabaseAccess.dll:

[csc] ...NUnit/Libraries/TestDatabaseAccess.cs(98,16): The type
IDataReader has two conflicting definitions, one comes from System.Data,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 and
the other from System.Data, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e0 89error
[csc] ...NUnit/Libraries/TestDatabaseAccess.cs(103,4): error CS0029:
Cannot implicitly convert type `System.Data.IDataReader' to
`System.Data.IDataReader'
...


The only difference I see is /usr/lib/mono/1.0/log4net.dll (note the
1.0,note 2.0). But,again,I don understand why mono does simply use the
version the assembly was compiled with (2.0)

Julien


More information about the Mono-list mailing list