1

I have tried several of your suggestions. I assume that SQL Compact Framework 4 will work with VS 2008 Version 3.5 SP1. Thank you for your help.

Felice

Server Error in '/' Application.

Could not load file or assembly 'System.Data.SqlServerCe.Entity' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.BadImageFormatException: Could not load file or assembly 'System.Data.SqlServerCe.Entity' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Data.SqlServerCe.Entity' could not be loaded.

=== Pre-bind state information === LOG: User = MONTOYA\Felice LOG: DisplayName = System.Data.SqlServerCe.Entity (Partial) LOG: Appbase = file:///C:/Documents and Settings/Felice/My Documents/Visual Studio 2008/Projects/WEBTEST/WEBTEST/ LOG: Initial PrivatePath = C:\Documents and Settings\Felice\My Documents\Visual Studio 2008\Projects\WEBTEST\WEBTEST\bin

Calling assembly : (Unknown).

LOG: This bind starts in default load context. LOG: Using application configuration file: C:\Documents and Settings\Felice\My Documents\Visual Studio 2008\Projects\WEBTEST\WEBTEST\web.config LOG: Using machine configuration file from c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config. LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind). LOG: Attempting download of new URL file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/root/22f9383d/8a864690/System.Data.SqlServerCe.Entity.DLL. LOG: Attempting download of new URL file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/root/22f9383d/8a864690/System.Data.SqlServerCe.Entity/System.Data.SqlServerCe.Entity.DLL. LOG: Attempting download of new URL file:///C:/Documents and Settings/Felice/My Documents/Visual Studio 2008/Projects/WEBTEST/WEBTEST/bin/System.Data.SqlServerCe.Entity.DLL. ERR: Failed to complete setup of assembly (hr = 0x8013101b). Probing terminated.

Felice
  • 21
  • 2
  • See my answer on **[System.BadImageFormatException: Reference assemblies should not be loaded for execution](https://stackoverflow.com/questions/61336306/system-badimageformatexception-reference-assemblies-should-not-be-loaded-for-ex/61702386#61702386)**. – Murat Yıldız May 09 '20 at 19:22

1 Answers1

1

See the reply here (including additions to web.config) (the runtime section is not required) Can't get sql server compact 3.5 / 4 to work with ASP .NET MVC 2

Community
  • 1
  • 1
ErikEJ
  • 40,951
  • 5
  • 75
  • 115
  • Tried everything in that post with no luck. The documentation states that SQL Compact Framework 4.0 will work in .NET 3.5 SP1 but I do not think this is the case....correct me if I am wrong.... – Felice Feb 01 '11 at 19:11
  • You are wrong, something else is causing the error :-) - are you running under Full Trust? – ErikEJ Feb 02 '11 at 07:19
  • Are you the same ErikEJ that wrote the ExportSQLCE program? I believe I am running in Full Trust? I have VS 2003, 2005, and 2008 installed so I do sometimes get these binding issues. But this .dll look like 4.0 so I wasn't sure if it is looking to have .net 4.0 framework installed. I might try to get it working on a fresh machine. But in thoery, VS 2008 should be able to use SQL Compact Framework 4.0 correct? – Felice Feb 03 '11 at 15:54
  • I got it to work. Had to swap out the Entity .dll with the 3.5 version of the Entity.dll – Felice Feb 03 '11 at 18:15