c# - Entity Framework issue - "Mixed mode assembly...cannot be loaded in the 4.0 runtime without additional configuration information" -
I have the UI & amp; Library project for solution where i am having problems library project unit framework & amp; Unit tests work fine with it. The project is a C # 4.0 WPF application.
To get a basic EF line code to work, I copied the connection string from the Library Project app.config to the UI project in app.config.
When I run the project with a simple EF test line (see below) I get an error below Note that both projects are already set to use the .NET Framework 4. I use other libraries such as quartz.net, however, as long as I do not include the line below, everything works fine.
Any suggestions on how to fix this problem?
// Use only test (var dbContext = new Model1Container ()) {Debug.WriteLine ("Total Uses =" + dbContext.Usages.Count ()); }
Error:
"Composite mode is built against the assembly runtime version 'v2.0.50727' and did not load in 4.0 Can run runtime without additional configuration information ".
The connection string I copied to the UI project app.config
& lt; ConnectionStrings & gt; & Lt; Add name = "Model1Container" connection string = "metadata = ridge: //*/Model1.csdl | res: //*/Model1.ssdl | res: //*/Model1.msl; provider = System.Data.SQLite; Provider Connection String = 'Data Source = & amp; quot; C: \ Documents and Settings \ Owner \ My Documents \ My Dropbox \ Source \ MyInternet Usage \ MyInternetUsable Library \ MyInternetUsage.sqlite & amp; quot;' 'ProviderName = "System.Data.EntityClient" / & gt; & lt; / ConnectionStrings & gt;
Add the following command to your app.config
& quot; startup usage Legacy V2RuntimeActivationPolicy =" true "& gt; & lt; supported version variant =" v4.0 "/ & Gt; & lt; / startup & gt;
This should fix your Mixed Mode issue.
Comments
Post a Comment