0

I have an application with EF 4.3.0 and Microsoft SQL Server CE 4.0.

Whenever I try to load the application, I get the following in error:

This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. (Exception from HRESULT: 0x800736B1)

at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Data.SqlServerCe.UnmanagedLibraryHelper..ctor(String fileName)
at System.Data.SqlServerCe.NativeMethodsHelper..ctor(String modulePath)
at System.Data.SqlServerCe.NativeMethods.LoadValidLibrary(String modulePath)
at System.Data.SqlServerCe.NativeMethods.LoadNativeBinaries()
at System.Data.SqlServerCe.SqlCeConnection..ctor()
at System.Data.SqlServerCe.SqlCeProviderFactory.CreateConnection()
at System.Data.Entity.Infrastructure.SqlCeConnectionFactory.CreateConnection(String nameOrConnectionString)
at System.Data.Entity.Internal.LazyInternalConnection.Initialize()
at System.Data.Entity.Internal.LazyInternalConnection.get_ProviderName()
at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
at System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
at System.Data.Entity.Internal.Linq.InternalSet`1.GetEnumerator()
at System.Data.Entity.Infrastructure.DbQuery`1.System.Collections.IEnumerable.GetEnumerator()
at System.Data.Entity.DbExtensions.Load(IQueryable source)
at TestEfSqlCeOnXp.MainWindow.Window_Loaded(Object sender, RoutedEventArgs e)

I have tried the following approaches (with no luck) to solve the problem:

  1. Created a simple app with just EF and SQL CE
  2. Tried the solution in: How to deploy SQL Server Compact Edition 4.0?
  3. Private install: http://msdn.microsoft.com/en-us/library/aa983326%28VS.80%29.aspx
  4. Was getting "SideBySide" error in the Event Viewer, tried installing the "Microsoft Visual C++ 2008 Redistributable Package (x86)" in http://www.microsoft.com/en-ca/download/details.aspx?id=29, didn't help either

Just more info on the WPF app, it works on Windows 7/8 but we're trying to retrofit it unto XP as this is a requirement for the project.

Thanks in advance StackOverflow community.

'Akapet

Community
  • 1
  • 1
akapet
  • 31
  • 3
  • It is unclear if you tried just installing the 4.0 MSI, did you try that? Are you referncing the 4.0.0.0 or 4.0.0.1 assembly version? Are you on XP SP3 (required)? – ErikEJ Feb 25 '14 at 07:50
  • Thx @ErikEJ. Yes I have version SQL CE 4.0.8876.1 installed and referencing this same version in my application. And yes I do have XP Pro Version 2002 SP3. – akapet Feb 25 '14 at 16:45

1 Answers1

0

Problem solved:

ErickEJ made a good point of referencing 4.0.0.0 or 4.0.0.1 but I was already doing this. This made me to check the version of SQL Server CE I have installed on the XP machine, which was SQL CE 4.0.8876.1, and happened to be 4.0 SP1.

So the solution is uninstalling 4.0 SP1 and installing just 4.0 (no SP1) of SQL CE.

Now I don't get the error anymore, database gets created and no "SideBySide" error in the Event Viewer.

Thx all.

akapet
  • 31
  • 3