2013-03-04 25 views
26

Tôi gặp sự cố sau:Tại sao System.Core không tải được khi thêm hỗ trợ giao diện người dùng Coded cho ứng dụng Silverlight 5?

Cố gắng thêm hỗ trợ tạo thử nghiệm giao diện người dùng được mã hóa cho ứng dụng Silverlight 5 ([MSDN] [1]). Bước đầu tiên là tham khảo assembly Microsoft.VisualStudio.TestTools.UITest.Extension.SilverlightUIAutomationHelper.dll trong dự án Silverlight 5. Thật không may, sau khi tham khảo đã được thêm vào, các dự án dừng lại để biên dịch với một số lỗi tương tự:

>

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 


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

First log: 

> 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. 

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

But second log entry produces the following error: 

> 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). 

Hình như Microsoft.VisualStudio.TestTools.UITest.Extension.SilverlightUIAutomationHelper.dll cố gắng để tải System.Core, Phiên bản = 2.0.5.0, Văn hóa = trung lập, PublicKeyToken = 7cec85d7bea7798e, nhưng đang được chuyển hướng đến System.Core, Phiên bản = 5.0.5.0, Văn hóa = trung lập, PublicKeyToken = 7cec85d7bea7798e (đã được tải từ nhật ký 1) và vẫn không thành công để tải.

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


    [1]: http://msdn.microsoft.com/en-us/library/gg413374.aspx 
+2

System.Core, Version = 2.0.5.0 dĩ nhiên là vấn đề. Phiên bản cũ hơn của hội đồng, được sử dụng trong các phiên bản trước của Silverlight. Họ đã không hoàn thành công việc cho VS2012, kiểm tra [bài đăng trên blog] này (http://blogs.msdn.com/b/bharry/archive/2012/07/09/coded-ui-testing-support-for-silverlight .aspx). –

+0

Tôi đã kiểm tra nó với VS2010 - chuyển hướng từ machine.config không hoạt động ở đó. Nó tạo ra một lỗi không tìm thấy System.Core 2.0.5.0, kể từ khi tham chiếu dự án 5.0.5.0. Lạ, vì chúng ta sử dụng cùng một phiên bản .Net Framework. – Cortlendt

+0

@HansPassant: Bạn có nghĩ rằng nên đăng liên kết đó làm câu trả lời hay không? Tôi biết nó không phải là một giải pháp hoàn hảo, nhưng tôi nghĩ rằng nó có thể là lựa chọn tốt nhất. –

Trả lời

1

Để xác nhận phiên bản của System.Core theo yêu cầu của SilverlightUIAuthomationHelper thực hiện như sau:

  1. tìm ra SilverlightUIAuthomationHelper dll được giới thiệu trên đĩa.
  2. tải nó lên trong bất kỳ bộ tách/phản xạ nào - ví dụ: dotPeek hoặc Reflector.
  3. phiên bản kiểm tra của hội đồng tham chiếu - System.Core phải 2.0.5.0 trong các phiên bản của SilverlightUIAuthomationHelper

giải pháp có thể:

  1. cập nhật SilverlightUIAuthomationHelper lên phiên bản mới (liên kết trong Hans passant bình luận) tham khảo mới System.Core dll (phiên bản 5.0.5.0)
  2. Bởi vì fuslogvw nói rằng chuyển hướng từ 2.0.5.0 đến 5.0.5.0 nằm trong tệp cấu hình APPLICATION - hãy thử tìm và loại bỏ chuyển hướng này (details here). Nhưng rất có thể là cái gì đó khác sẽ phá vỡ.
Các vấn đề liên quan