jonpryor / dblinq2007

Automatically exported from code.google.com/p/dblinq2007
0 stars 0 forks source link

The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047) #269

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. call the Main() constructor from dbmetal generated class in my app code

What is the expected output? What do you see instead?
Hi there. is there any solution for this problem? im trying to use
        Sqlite database in my app project.
        the connection string i use is
        "DbLinqProvider=Sqlite;"DbLinqConnectionType=System.Data.SQLite.SQLiteConnection,
        System.Data.SQLite, Version=1.0.66.0, Culture=neutral,
        PublicKeyToken=db937bc2d44ff139Data Source= mydb.db";

        and when i run the command  i get the exception
        The given assembly name or codebase was invalid. (Exception from
        HRESULT: 0x80131047)

Please use labels and text to provide additional information.
database vendor sqlite
dblin1 version 0.20.1

Original issue reported on code.google.com by malybirko on 6 Aug 2010 at 1:31

GoogleCodeExporter commented 9 years ago
Running DbMetal with --debug would help, as it will provide the stack trace of 
the error message.

That said, did you properly copy the connection string into this bug report?  
It's incorrect -- there's an extraneous double-quote in the middle (after 
DbLinqProvider=Sqlite) and there's a missing semicolon before the Data Source 
parameter.

Try:

    "DbLinqProvider=Sqlite; " +
    "DbLinqConnectionType=System.Data.SQLite.SQLiteConnection, " +
    "System.Data.SQLite, Version=1.0.66.0, Culture=neutral, " +
    "PublicKeyToken=db937bc2d44ff139; " +
    "Data Source= mydb.db";

Original comment by jonmpr...@gmail.com on 6 Aug 2010 at 2:38

GoogleCodeExporter commented 9 years ago
I probably pasted the connectionstring badly here but your string helped but 
now i have other exception by the code running  in 
public Main(string connectionString)  method

Mixed mode assembly is built against version 'v2.0.50727' of the runtime and 
cannot be loaded in the 4.0 runtime without additional configuration 
information.

Original comment by malybirko on 6 Aug 2010 at 2:54

GoogleCodeExporter commented 9 years ago
You're presumably building DbLinq with VS2010 and you're targeting .NET 4.0 
(i.e. DbMetal.exe is a v4.0 assembly).

I would check your project options to see which runtime you're targeting to 
confirm that hypothesis, and if you are targeting .NET 4.0 then you should 
change the target runtime to 2.0 and rebuild DbLinq/DbMetal.

Alternatively, you could provide a DbMetal.exe.config which specifies that the 
System.Data.SQLite.dll assembly should be loaded, but I don't know the XML-fu 
needed to do that (assuming it's possible).

Original comment by jonmpr...@gmail.com on 6 Aug 2010 at 3:08

GoogleCodeExporter commented 9 years ago
Ow. it was the problem for System.Data.SQLite i added this in configuration

<configuration>
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0"/>
  </startup>
</configuration>

Anyway thx for help

Original comment by malybirko on 6 Aug 2010 at 7:10

GoogleCodeExporter commented 9 years ago

Original comment by jonmpr...@gmail.com on 6 Aug 2010 at 9:20