0

Im trying do my first steps in Winforms development with C# and .NET framework. I want to make a little users CRUD application. I have the SQLite db populated with test data.

So, i create a blank project solution, and added a "Class library" project called "DataBundle".

In the DataBundle, have the entity class for the database, mapped with Entity Framework.

Also, i created a console application for test my DataBundle. The app build correctlly, but when try run querys the application throw an exception.

This is my code:

Console.WriteLine("Testeando el DataBudnle ...");
mainContext _dao = new mainContext();

Zone city = new Zone
{
  name = "Ensenada"
};

Console.WriteLine("Existen {0} ciudades registradas ...", _dao.Zones.Count());
Console.ReadLine();

And the exception message is:

The mixed-mode assembly is compiled with 'v2.0.50727' version of the runtime and can not be loaded in the 4.0 runtime without additional configuration information.

Im using Visual Studio 2010 Ultimate, Windows 7 Professional with .NET 4 Framework installed.

Any ideas ?

ramiromd
  • 2,019
  • 8
  • 33
  • 62
  • 2
    http://stackoverflow.com/questions/2455654/what-additional-configuration-is-necessary-to-reference-a-net-2-0-mixed-mode – Steve Aug 24 '14 at 18:19

1 Answers1

1

As Steve suggested there, add this in the console application App.config file

<?xml version="1.0"?>
<configuration>
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
  </startup>
</configuration>
Chandan Kumar
  • 4,570
  • 4
  • 42
  • 62