我正在开发一个使用 SQLite 的 Outlook 插件。Outlook 引发异常无法绑定程序集。我启用了融合日志,发现“托管程序集”加载正常,因为它可以从以下日志中看到
*** 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.
但是根据以下异常,它在加载本机程序集时引发异常。
*** 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.
我不知道,为什么会这样。这发生在发布版本之后的一台客户端机器上。即使在发布版本之后,在我的机器上它也可以正常工作。
即便如此,即使在异常之后,添加也可以正常工作。
问候莫希特·塔克拉尔