This question is locked. New answers and comments are not allowed.
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:
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
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