views:

30

answers:

1

So I am getting the same exception as a lot of other people when I am trying to run an execute statement into my SQLite database in my Windows Forms project in Visual Studio 2010. The exception reads:

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.

The exception type is : FileLoadException

Now I found all of the other peoples solutions and changed my app.config to this:

<?xml version="1.0"?>
<configuration>
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
  </startup>
</configuration>

But I save, re-compile, step through the code...same exception.

Do any of you have any idea what this could be?

+1  A: 

Yes it is more than just that configuration; there is metadata within the solution so I would change the actual project 'Compile' properties on the .dll or project you are trying to update.

In Solution Explorer within VS.NET, right-click the project and select Properties. From there select the Compile tab on the left-hand side and then press the Advanced Compile Options button. The last dropdown contains 'Target Framework' which you can change to .NET Framework 4.0 if you wish. I recommend to keep all projects within a solution targeting the same framework version, or otherwise the error you encountered will occur. It happened to me to when I converted a project from VS.NET 2008 to 2010, and only 1 of the 3 projects in the solution got upgraded to the .NET Framework 4.0; but this was easy enough to change

Clean and rebuild the solution and then make sure the referencing project does have the new version. This should fix the issue.

atconway
your a lifesaver
Scott