Search code examples
.net-coresql-server-ce

.net core to sqlserverce issue


I am trying to connect to a SQL Server CE (.sdf) file using the .Net Core console. I keep on getting the error below whereas the same code is working properly in the .Net Framework.

Can anyone suggest to me what the issue is?

The type initializer for 'System.Data.SqlServerCe.KillBitHelper' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Security.Permissions


Solution

  • It is not possible and not supported, System.Data.SqlServerCe requires the full .NET Framework and Windows.

    UPDATE It is actually possible (on Windows only) with .NET Core 3.x - see https://github.com/dotnet/corefx/issues/33897#issuecomment-536269132