llblgen and npgsql runtime references

Posts   
 
    
hibernatus
User
Posts: 2
Joined: 18-Sep-2009
# Posted on: 18-Sep-2009 12:08:08   

We're developing an app with a postgreSQL db backend (actually enterprise db) Being in the process of writing unit tests for classes doing some db queries, I started using linq and llblgen to prepare db context for unit testing. The testing framework used is nunit. When I run tests, the nunit output started complaining about a missing npgsql assembly (although npgsql assembly (version 2.0.6.0) is referenced in the test project) :

System.IO.FileLoadException : Could not load file or assembly 'Npgsql, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.

The point is: in our startup project, it seems like we had to use an assembly redirect (in the app.config) to make the app stop complaining about the missing npgsql 1.0 dll, and link to the 2.0.6 one. But in the context I can't tell nunit program how to redirect (except adding a redirect to the machine configuration, which I can't !)

So the question is wink : Why does llblgen libs seem to search for a specific version of npgsql (1.0.0.0) with a public key token matching the 2.0.6 dll ? Where and how can I edit (template, generated project, ...) to fix this unit test runtime issue ?

Thanks in advance for any suggestion !

Walaa avatar
Walaa
Support Team
Posts: 14981
Joined: 21-Aug-2005
# Posted on: 18-Sep-2009 13:17:24   

You may change the reference in the DQE assembly and rebuild it. (The source code is available in the installation folder).

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39730
Joined: 17-Aug-2003
# Posted on: 18-Sep-2009 14:02:29   

Or add an assembly redirection from 1.0.0.0 to 2.0.6.0 in your application's .config file

Frans Bouma | Lead developer LLBLGen Pro
hibernatus
User
Posts: 2
Joined: 18-Sep-2009
# Posted on: 23-Sep-2009 16:31:29   

Thank you for your suggestions, I had to update Npgsql assembly reference (to 2.0.6.0) in PostgreSqlDQE project, then rebuilt ORM, DQE and LinqSupport, before recompiling our projects referencing llblgen classes.

I rebuilt my NUnit test project assembly and it worked flawlessly without even having to edit nunit app.config file for assembly redirection.

Our app is now only referencing the latest npgsql assembly version.

Note it was a pain to troubleshoot the error since it was only occurring at runtime, probably because llblgen runtime libs try to load an assembly using reflection or Assembly.Load

ztron
User
Posts: 13
Joined: 30-Mar-2012
# Posted on: 26-Aug-2022 04:42:52   

I was able to reproduce this issue with a clean install of LLBLGen 5.9 with the version of Npgsql installed in the 'C:\Program Files (x86)\Solutions Design\LLBLGen Pro v5.9\Drivers\PostgreSql' folder.

The Npsql.dll is '.NetStandard v2.0' while the SD.LLBLGen.Pro.DBDrivers.PostgreSqlDBDriver.dll is '.Net Framework v4.7.2'.

so it looks like a .Net version clash?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39730
Joined: 17-Aug-2003
# Posted on: 26-Aug-2022 09:15:50   

ztron wrote:

I was able to reproduce this issue with a clean install of LLBLGen 5.9 with the version of Npgsql installed in the 'C:\Program Files (x86)\Solutions Design\LLBLGen Pro v5.9\Drivers\PostgreSql' folder.

The Npsql.dll is '.NetStandard v2.0' while the SD.LLBLGen.Pro.DBDrivers.PostgreSqlDBDriver.dll is '.Net Framework v4.7.2'.

so it looks like a .Net version clash?

You're replying to a thread that's 13 years old. I doubt it's the same issue. The Npgsql shipped with the designer is one which we know works with the designer on .net framework. I have no idea what issue you run into so start a new thread with a description of your problem.

Frans Bouma | Lead developer LLBLGen Pro