【问题标题】:Xamarin forms Sqlite WinPhone SQLitePCL.raw' threw an exception System.TypeInitializationExceptionXamarin 表单 Sqlite WinPhone SQLitePCL.raw' 抛出异常 System.TypeInitializationException
【发布时间】:2016-04-27 19:40:29
【问题描述】:

我正在尝试让 Xamarin 表单 sqlite 运行起来。

它适用于 Android 和 iOS,但对于 Windows,我收到此错误。 我的目标是 windows phone 8.1 的解决方案并使用 Xamarin forms 1.5(我无法升级它)

我一直在关注来自 Xamarin 的 this 示例

public class SQLite_WinPhone : ISQLite
    {
        public SQLite_WinPhone() { }
        protected override SQLite.SQLiteConnection GetConnection()
        {
            var sqliteFilename = "TODO.db3";
            string path = Path.Combine(ApplicationData.Current.LocalFolder.Path, sqliteFilename);
            // Create the connection
            var conn = new SQLite.SQLiteConnection(path);
            // Return the database connection
            return conn;
        }
    }

但到目前为止还没有运气。

你们中有人遇到过这种情况吗?

【问题讨论】:

    标签: c# sqlite windows-phone-8.1 xamarin-forms


    【解决方案1】:

    Android 和 iOS 附带 SQLite 运行时,Windows 没有。

    你需要添加:

    1. SQLitePCL.raw 包到您的 Windows 应用程序。
    2. Windows 应用程序的当前 c++ 运行时包
      • 在解决方案资源管理器中右键单击引用,选择 Windows > Extensions > Microsoft Visual c++ Runtime Package

    【讨论】:

    • 确实如此,但正如我在问题中所说,我为此遵循 xamarin 指南,其中解释了您需要这样做。所以我做了。不过还是谢谢
    • 抱歉,在该教程中没有看到 c++ 运行时提示。异常消息说明了什么?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-07-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多