3
即使引用fs項目中的模塊,SQLite .NET包也不會在FSI中工作。我試過System.Data.SQLite,SQLitePCL.raw和Microsoft.Data.Sqlite。SQLite無法從F#執行FSI
如果啓動的過程中可執行完全的託管代碼組成,它會隨着機器的本機處理器架構,這將是在x64機器在x64運行。稍後,這將導致包含爲x86編譯的任何本地代碼的程序集(例如「System.Data.SQLite.dll」混合模式程序集,「SQLite.Interop.dll」本機互操作程序集或「sqlite3.dll」本機庫)無法加載,通常會導致引發BadImageFormatException。
的錯誤通常拋出貌似
System.DllNotFoundException: Unable to load DLL 'sqlite3': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at Microsoft.Data.Sqlite.Interop.NativeMethods.sqlite3_open_v2(IntPtr filename, Sqlite3Handle& ppDb, Int32 flags, IntPtr vfs)
at Microsoft.Data.Sqlite.Interop.NativeMethods.sqlite3_open_v2(String filename, Sqlite3Handle& ppDb, Int32 flags, String vfs)
at Microsoft.Data.Sqlite.SqliteConnection.Open()
at <StartupCode$FSI_0009>[email protected]() in E:\BitSync\NonGitProjects\SQLiteSandbox\Microsoft.DataSandbox\Scripts\Script1.fsx:line 7
有沒有人找到了解決這個? SQLite在編譯的F#程序和調試模式下工作得很好。
32位或64位的FSI? –
不知道你是否試過這個,或者它是否會幫助,但不能傷害提及它。請參閱:[在F#Interactive中加載原生DLL](http://christoph.ruegg.name/blog/loading-native-dlls-in-fsharp-interactive.html) –
@GuyCoder這正是幫助我使它工作一些幾周前。 – TeaDrivenDev