This is a migrated thread and some comments may be shown as answers.

SQLite built against .Net 2

1 Answer 77 Views
Data Access Free Edition
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Kevin
Top achievements
Rank 1
Kevin asked on 10 Jun 2013, 01:03 PM
Hello

I'm struggling with Open Access and SQLite in our unit test project. We would like to have an environment that requires almost no setup - so we included Open Access based on How to: Use OpenAccess ORM Without Installing It. Everything is working fine, but when we are trying to use SQLite for our Unit Tests, we get the following Exception
Database provider System.Data.SQLite.SQLiteFactory, System.Data.SQLite, Version=1.0.81.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139 not installed properly (CLR=v4.0.30319 32bit). ---> System.IO.FileLoadException: 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.

Now, the solution I found on sites like Stackoverflow is to just add the following lines to your App.Config file:
<startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
    <requiredRuntime version="v4.0.20506" />
</startup>

Unfortunately (and this is some Microsoft ****), a Unittest Project uses the vstest.executionengine.exe.config from the Visual Studio installation directory. And I want to avoid that at all cost - since admin permission is needed and it has to be done on every developer machine.

I thought I could replace the SQLite.dll in the OpenAccess libraries. However, when I do this, I either get a BadImageFormatException:
System.BadImageFormatException: Could not load file or assembly 'System.Data.SQLite, Version=1.0.81.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139' or one of its dependencies. An attempt was made to load a program with an incorrect format..

or a FileLoadException:
System.IO.FileLoadException: Could not load file or assembly 'System.Data.SQLite, Version=1.0.81.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040).

Is there any way to change the dll to a version compiled for .NET 4? Do I miss something? Or is it really needed to add that configuration, which would be pretty sad... I am happy for every hint I get.

Thanks in advance
Kevin

1 Answer, 1 is accepted

Sort by
0
Boris Georgiev
Telerik team
answered on 13 Jun 2013, 11:01 AM
Hi Kevin,

Unfortunately we could not provide you with a different solution. You will have to change the config file in the Visual Studio installation directory and you will need admin rights for this.

Sorry for the inconvenience caused.

Regards,
Boris Georgiev
Telerik
OpenAccess Samples Kit boasts 50+ sample applications providing diverse real-life business solutions. Click to read more and see OpenAccess ORM in action.
Tags
Data Access Free Edition
Asked by
Kevin
Top achievements
Rank 1
Answers by
Boris Georgiev
Telerik team
Share this question
or