添加为Silverlight 5应用程序codeD UI支持 - System.Core程序加载失败应用程序、加载、程序、codeD

2023-09-04 07:15:23 作者:午夜第一根烟

我有如下问题:

尝试添加支持创建codeD UI测试的Silverlight 5应用程序( MSDN )。第一步是参考在Silverlight 5的项目汇编Microsoft.VisualStudio.TestTools.UITest.Extension.SilverlightUIAutomationHelper.dll。不幸的是,参考已被添加之后,项目停止编译与多个类似的错误:

Trying to add support for creating coded UI test for Silverlight 5 application (MSDN). First step is to reference assembly Microsoft.VisualStudio.TestTools.UITest.Extension.SilverlightUIAutomationHelper.dll in Silverlight 5 project. Unfortunately, after the reference has been added, projects stops to compile with a number of similar errors:

错误25无法解析引用程序集。请参阅相关组件。无法加载文件或程序集System.Core程序,版本= 5.0.5.0,文化=中性公钥= 7cec85d7bea7798e或它的某一个依赖。找到的程序集清单定义不匹配的程序集引用。 (从HRESULT异常:0x80131040).... \ ErrorReportDialog.xaml

Error 25 Cannot resolve reference assemblies. Please check the reference assemblies. Could not load file or assembly 'System.Core, Version=5.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) ....\ErrorReportDialog.xaml

看起来System.Core程序5.0.5.0加载失败,还好,调试组件加载与Fuslogw产生两个有趣的日志:

Looks like System.Core 5.0.5.0 fails to load, okay, debugging assemblies loading with Fuslogw produces two interesting logs:

第一个日志:

大会粘结剂日志条目(2013年3月4日@十四点07分49秒)   手术很成功。   绑定结果:HR =为0x0。操作已成功完成。   C:从装配​​经理装\的Windows \ Microsoft.NET \框架\ v4.0.30319 \ clr.dll   下可执行的C运行:\ WINDOWS \ Microsoft.NET \框架\ v4.0.30319 \ MSBuild.exe   详细的错误日志如下。   === pre-绑定状态信息===   日志:显示名称= System.Core程序,版本= 5.0.5.0,文化=中性公钥= 7cec85d7bea7798e    (完全限定)   日志:应用平台=文件:/// C:/Windows/Microsoft.NET/Framework/v4.0.30319/   LOG:初始PrivatePath = NULL   日志:动基座= NULL   日志:缓存基地= NULL   LOG:AppName的= MSBuild.exe   调用汇编:System.Windows,版本= 5.0.5.0,文化=中性公钥= 7cec85d7bea7798e。   日志:此绑定从LoadFrom负载范围内。   警告:本机图像不会被探测的LoadFrom上下文。本机映像将只探测默认加载上下文中,喜欢用的Assembly.Load()。   日志:正在使用应用程序配置文件:C:\ WINDOWS \ Microsoft.NET \框架\ v4.0.30319 \ MSBuild.exe.Config   日志:使用主机配置文件:   日志:从C使用计算机配置文件:\ WINDOWS \ Microsoft.NET \框架\ v4.0.30319 \ CONFIG \ machine.config中。   日志:后政策参考:System.Core程序,版本= 5.0.5.0,文化=中性公钥= 7cec85d7bea7798e   日志:绑定成功。汇编从C返回:\ Program Files文件(x86)的\参考大会\微软\框架\ Silverlight的\ 5.0 \ System.Core.dll的。   LOG:大会加载LoadFrom加载上下文

Assembly Binder Log Entry (04.03.2013 @ 14:07:49) 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:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe A detailed error log follows. === Pre-bind state information === LOG: DisplayName = System.Core, Version=5.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e (Fully-specified) LOG: Appbase = file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/ LOG: Initial PrivatePath = NULL LOG: Dynamic Base = NULL LOG: Cache Base = NULL LOG: AppName = MSBuild.exe Calling assembly : System.Windows, Version=5.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e. LOG: This bind starts in LoadFrom load context. WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load(). LOG: Using application configuration file: C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.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.Core, Version=5.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e LOG: Binding succeeds. Returns assembly from C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v5.0\System.Core.dll. LOG: Assembly is loaded in LoadFrom load context.

看起来像System.Core程序,版本= 5.0.5.0,文化=中性公钥= 7cec85d7bea7798e负载成功地。

Looks like System.Core, Version=5.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e loads succesfully.

但第二日志条目产生以下错误:

But second log entry produces the following error:

大会粘结剂日志条目(2013年3月4日@十四点07分49秒)   操作失败。   绑定结果:HR = 0x80131040。没有可用的描述。   C:从装配​​经理装\的Windows \ Microsoft.NET \框架\ v4.0.30319 \ clr.dll   下可执行的C运行:\ WINDOWS \ Microsoft.NET \框架\ v4.0.30319 \ MSBuild.exe   详细的错误日志如下。   pre-绑定状态信息   日志:显示名称= System.Core程序,版本= 2.0.5.0,文化=中性公钥= 7cec85d7bea7798e    (完全限定)   日志:应用平台=文件:/// C:/Windows/Microsoft.NET/Framework/v4.0.30319/   LOG:初始PrivatePath = NULL   日志:动基座= NULL   日志:缓存基地= NULL   LOG:AppName的= MSBuild.exe   调用汇编:Microsoft.VisualStudio.TestTools.UITest.Extension.SilverlightUIAutomationHelper,版本= 10.0.30319.381,文化=中性公钥= b03f5f7f11d50a3a。   日志:此绑定从default加载上下文。   日志:正在使用应用程序配置文件:C:\ WINDOWS \ Microsoft.NET \框架\ v4.0.30319 \ MSBuild.exe.Config   日志:使用主机配置文件:   日志:从C使用计算机配置文件:\ WINDOWS \ Microsoft.NET \框架\ v4.0.30319 \ CONFIG \ machine.config中。   日志:重定向在应用程序配置文件中找到:2.0.5.0重定向到5.0.5.0。   日志:后政策参考:System.Core程序,版本= 5.0.5.0,文化=中性公钥= 7cec85d7bea7798e   日志:相同的绑定已出现过,并失败,HR = 0x80131040。   错误:pre下载检查(HR = 0x80131040)过程中发生不可恢复的错误

Android 2.3.5加全新智囊4.0UI界面

Assembly Binder Log Entry (04.03.2013 @ 14:07:49) The operation failed. Bind result: hr = 0x80131040. No description available. Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll Running under executable C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe A detailed error log follows. Pre-bind state information LOG: DisplayName = System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e (Fully-specified) LOG: Appbase = file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/ LOG: Initial PrivatePath = NULL LOG: Dynamic Base = NULL LOG: Cache Base = NULL LOG: AppName = MSBuild.exe Calling assembly : Microsoft.VisualStudio.TestTools.UITest.Extension.SilverlightUIAutomationHelper, Version=10.0.30319.381, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. LOG: This bind starts in default load context. LOG: Using application configuration file: C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.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: Redirect found in application configuration file: 2.0.5.0 redirected to 5.0.5.0. LOG: Post-policy reference: System.Core, Version=5.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e LOG: The same bind was seen before, and was failed with hr = 0x80131040. ERR: Unrecoverable error occurred during pre-download check (hr = 0x80131040).

看起来Microsoft.VisualStudio.TestTools.UITest.Extension.SilverlightUIAutomationHelper.dll尝试加载System.Core程序,版本= 2.0.5.0,文化=中性公钥= 7cec85d7bea7798e,但被重定向到System.Core程序,版本= 5.0.5.0,文化=中性公钥= 7cec85d7bea7798e(从第1记录已经加载),仍然无法加载。

Looks like Microsoft.VisualStudio.TestTools.UITest.Extension.SilverlightUIAutomationHelper.dll tries to load System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, but is being redirected to System.Core, Version=5.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e (already loaded from 1st log) and still fails to load.

任何人都可以提供有关如何进一步调试这个问题的一些见解?我在编译的Silverlight项目值为anycpu平台。

Can anyone provide some insight on how to further debug this problem? I'm compiling Silverlight projects for AnyCpu platform.

推荐答案

要确认版本System.Core程序由SilverlightUIAuthomationHelper需要执行以下操作:

To confirm version of System.Core required by SilverlightUIAuthomationHelper do the following:

找到磁盘上的引用SilverlightUIAuthomationHelper DLL。 在加载它在任何拆装/反射 - 例如dotPeek或反思。 检查引用的程序集的版本 - System.Core程序必须是2.0.5.0在SilverlightUIAuthomationHelper版本

可能的解决方案:

更新SilverlightUIAuthomationHelper到新版本(在汉斯帕桑特评论链接),它引用新System.Core程序的DLL(版本5.0.5.0) 由于fuslogvw说,从2.0.5.0重新定向到5.0.5.0位于应用程序配置文件 - 尝试找到并删除此重定向(的在这里详细)。但它很可能是别的东西将打破。 update SilverlightUIAuthomationHelper to the new version (link in the Hans Passant comment) that references new System.Core dll (version 5.0.5.0) Because fuslogvw says that redirect from 2.0.5.0 to 5.0.5.0 is located in the APPLICATION configuration file - try to find and remove this redirect (details here). But it is very possible that something else will break.