.net 核心到 sqlserverce 问题

.net core to sqlserverce issue

我正在尝试使用 .Net Core 控制台连接到 SQL 服务器 CE (.sdf) 文件。我不断收到以下错误,而相同的代码在 .Net Framework 中运行正常。

谁能告诉我问题出在哪里?

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

不可能也不支持,System.Data.SqlServerCe 需要完整的 .NET Framework 和 Windows。

UPDATE 使用 .NET Core 3.x 实际上是可能的(仅在 Windows 上)- 参见 https://github.com/dotnet/corefx/issues/33897#issuecomment-536269132