gpt4 book ai didi

c# - SQLite 1.0.65 程序集绑定(bind)错误

转载 作者:太空宇宙 更新时间:2023-11-03 13:56:33 26 4
gpt4 key购买 nike

我正在开发一个使用 SQLite 的 outlook 插件。 Outlook 抛出异常无法绑定(bind)程序集。我启用了融合日志,发现“托管程序集”加载正常,因为它可以从以下日志中看到

    *** Assembly Binder Log Entry  (16/08/2012 @ 14:13:37) ***

The operation was successful.
Bind result: hr = 0x0. The operation completed successfully.

Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable C:\Program Files\Microsoft Office\Office12\OUTLOOK.EXE
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: DisplayName = System.Data.SQLite, Version=1.0.65.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139
(Fully-specified)
LOG: Appbase = file:///C:/Program Files/TargetIntegration/CiviSync/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = OUTLOOK.EXE
Calling assembly : ServiceStack.OrmLite.SqliteNET, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Program Files\Microsoft Office\Office12\OUTLOOK.EXE.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: System.Data.SQLite, Version=1.0.65.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/Program Files/TargetIntegration/CiviSync/System.Data.SQLite.DLL.
LOG: Assembly download was successful. Attempting setup of file: C:\Program Files\<CompName>\CiviSync\System.Data.SQLite.dll
LOG: Entering download cache setup phase.
LOG: Assembly Name is: System.Data.SQLite, Version=1.0.65.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139
WRN: A duplicate assembly was found while copying the assembly item to the cache.
LOG: Binding succeeds. Returns assembly from C:\Users\<UserName>\AppData\Local\assembly\dl3\9N164N9X.7OK\DRB00MX7.CBX\2f49c891\005cc530_ea6ccd01\System.Data.SQLite.dll.
LOG: Assembly is loaded in default load context.

但它在加载 native 程序集时抛出异常,如下所示。

*** Assembly Binder Log Entry  (16/08/2012 @ 14:13:37) ***

The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.

Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable C:\Program Files\Microsoft Office\Office12\OUTLOOK.EXE
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: DisplayName = System.Data.SQLite, Version=1.0.65.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139
(Fully-specified)
LOG: Appbase = file:///C:/Program Files/TargetIntegration/CiviSync/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = OUTLOOK.EXE
Calling assembly : ServiceStack.OrmLite.SqliteNET, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: Start binding of native image System.Data.SQLite, Version=1.0.65.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139.
WRN: No matching native image found.
LOG: IL assembly loaded from C:\Users\<username>\AppData\Local\assembly\dl3\9N164N9X.7OK\DRB00MX7.CBX\2f49c891\005cc530_ea6ccd01\System.Data.SQLite.dll.

我不知道,为什么会这样。这是在发布构建后的一台客户端机器上发生的。在我的机器上,即使在发布版本之后它也能正常工作。

即便如此,即使在异常之后,添加也能正常工作。

问候莫希塔克拉尔

最佳答案

通常大多数 Sqlite 问题是 32 位/64 位 dll 不匹配的结果。您需要为您的平台选择最合适的 Sqlite 库:

仅 .NET 版本是混合模式程序集,嵌入了 native 版本的 sqlite3.dll,而 Mono/.NET 版本包含外部 32/64 位 Windows dll。如果您使用它,您需要将适当的 sqlite3.dll 复制到您的项目目录中,并将 Build Action 设置为 Copy If Newer

您应该能够为您的平台使用单模式或混合模式程序集。

关于c# - SQLite 1.0.65 程序集绑定(bind)错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11988337/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com