我正在尝试使用以下 app.config 设置程序集绑定重定向:
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.AnalysisServices"
PublicKeyToken="89845dcd8080cc91" />
<bindingRedirect oldVersion="10.0.0.0"
newVersion="9.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
我正在 GAC 中版本为 9.0.242.0 的计算机上运行该程序,并使用指定的公钥令牌。不过,CLR 似乎甚至没有尝试重定向绑定以使用该版本。
这是我在 fuslogvw.exe 中得到的内容:
LOG: This bind starts in default load context.
LOG: Using application configuration file: \Debug\AssemblyRedirectPOC.exe.Config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: Microsoft.AnalysisServices, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL /Debug/Microsoft.AnalysisServices.DLL.
LOG: Attempting download of new URL /Debug/Microsoft.AnalysisServices/Microsoft.AnalysisServices.DLL.
LOG: Attempting download of new URL /Debug/Microsoft.AnalysisServices.EXE.
LOG: Attempting download of new URL /Debug/Microsoft.AnalysisServices/Microsoft.AnalysisServices.EXE.
LOG: All probing URLs attempted and failed.
当我尝试将 9.0.242.0 版本 dll 放入探测路径时,我得到的是:
LOG: Assembly download was successful. Attempting setup of file: \Debug\Microsoft.AnalysisServices.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: Microsoft.AnalysisServices, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91
WRN: Comparing the assembly name resulted in the mismatch: Major Version
ERR: The assembly reference did not match the assembly definition found.
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
请注意,我还尝试将重定向更改为在 app.config 中使用“9.0.242.0”而不是“9.0.0.0”,但这不起作用,尽管我认为这不会产生任何影响。
据我了解,重定向绑定的全部目的是使用与构建程序的版本不匹配的版本。我在这里完全错过了什么吗?我想做的事情是否可能,如果可以,知道为什么它不起作用吗?
干杯,
亚当