我在我的Word插件中使用Microsoft.Bcl.Async,我的插件被編譯爲exe(test_addin.exe)文件,它是從Microsoft Word加載的程序集,當我直接啓動可執行文件時,一切工作正常,但是當我從Word運行它時,出現一條錯誤消息,指出它無法加載Systems.Threading.Tasks程序集。使綁定重定向工作的辦公室加載項
Could not load file or assembly System.Threading.Tasks...
看起來,它關係到綁定重定向,當我嘗試從Word中的應用,預計該配置文件,以設在'C:\Program Files (x86)\Microsoft Office\Office15'
文件夾並命名爲WINWORD.exe.config
,這是不幸的是不可能的,因爲我可能無法訪問該文件夾。
我test_addin.exe.config文件:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.9.0" newVersion="2.6.9.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.9.0" newVersion="2.6.9.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
我已經嘗試設置AppDomain.CurrentDomain.SetupInformation.ConfigurationFile
指向正確的路徑,但它似乎並沒有幫助,還有其他的方式,使之成爲一個工作Office加載項?
你是如何在你的代碼中添加的? – SsjCosty 2015-08-10 00:39:37
訂閱AppDomain.AssemblyResolve事件。 – animaonline 2015-08-15 12:27:59