2012-06-14 32 views
6

Tôi có giải pháp Visual Studio 2010 chứa thư viện lớp (ProjectA) và hai dự án Sharepoint (ProjectB & ProjectC). Thứ tự phụ thuộc là ProjectB tham chiếu ProejctA và ProjectC tham chiếu cả ProjectA & ProjectB.Lỗi ràng buộc lắp ráp: Kết quả liên kết: hr = 0x80070002. Hệ thống không thể tìm thấy tệp được chỉ định

Trên một máy phát triển đặc biệt tôi nhận được lỗi sau khi cố gắng xây dựng ProjectC:

Compilation failed. Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

Khi nhìn vào các bản ghi fusion tôi ghi nhận được lỗi sau:

* Assembly Binder Log Entry (14/06/2012 @ 09:38:32) *

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 (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe

--- A detailed error log follows.

=== Pre-bind state information === LOG: User = DOMAIN\username

LOG: DisplayName = ProjectB, Version=0.0.0.0, Culture=neutral, PublicKeyToken=aaaaaaaaaaaaaaaa, processorArchitecture=MSIL (Fully-specified)

LOG: Appbase = file:///C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/

LOG: Initial PrivatePath = NULL

LOG: Dynamic Base = NULL

LOG: Cache Base = NULL

LOG: AppName = devenv.exe

Calling assembly : (Unknown).

LOG: This bind starts in default load context.

LOG: Using application configuration file: C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.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: ProjectB, Version=0.0.0.0, Culture=neutral, PublicKeyToken=aaaaaaaaaaaaaaaa, processorArchitecture=MSIL

LOG: GAC Lookup was unsuccessful.

LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/ProjectB.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/ProjectB/ProjectB.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/PublicAssemblies/ProjectB.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/PublicAssemblies/ProjectB/ProjectB.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/PrivateAssemblies/ProjectB.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/PrivateAssemblies/ProjectB/ProjectB.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/CommonExtensions/Microsoft/TemplateProviders/ProjectB.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/CommonExtensions/Microsoft/TemplateProviders/ProjectB/ProjectB.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/PrivateAssemblies/DataCollectors/ProjectB.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/PrivateAssemblies/DataCollectors/ProjectB/ProjectB.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/PrivateAssemblies/DataCollectors/x86/ProjectB.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/PrivateAssemblies/DataCollectors/x86/ProjectB/ProjectB.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/CommonExtensions/Microsoft/Editor/ProjectB.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/CommonExtensions/Microsoft/Editor/ProjectB/ProjectB.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/CommonExtensions/Platform/Debugger/ProjectB.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/CommonExtensions/Platform/Debugger/ProjectB/ProjectB.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/ProjectB.EXE. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/ProjectB/ProjectB.EXE. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/PublicAssemblies/ProjectB.EXE. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/PublicAssemblies/ProjectB/ProjectB.EXE. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/PrivateAssemblies/ProjectB.EXE. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/PrivateAssemblies/ProjectB/ProjectB.EXE. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/CommonExtensions/Microsoft/TemplateProviders/ProjectB.EXE. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/CommonExtensions/Microsoft/TemplateProviders/ProjectB/ProjectB.EXE. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/PrivateAssemblies/DataCollectors/ProjectB.EXE. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/PrivateAssemblies/DataCollectors/ProjectB/ProjectB.EXE. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/PrivateAssemblies/DataCollectors/x86/ProjectB.EXE. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/PrivateAssemblies/DataCollectors/x86/ProjectB/ProjectB.EXE. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/CommonExtensions/Microsoft/Editor/ProjectB.EXE. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/CommonExtensions/Microsoft/Editor/ProjectB/ProjectB.EXE. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/CommonExtensions/Platform/Debugger/ProjectB.EXE. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/CommonExtensions/Platform/Debugger/ProjectB/ProjectB.EXE. LOG: All probing URLs attempted and failed.

Tôi đã thử:

  1. Xóa tham chiếu đến ProjectB và thêm lại tham chiếu cả hai:
    • a) như một tài liệu tham khảo dự án
    • b) như là một tài liệu tham khảo thủ công trực tiếp vào thư mục debug của projectB
  2. thủ đặt ProjectB.dll vào GAC
  3. Thay đổi "Sao chép địa phương" tùy chọn từ True thành False (và quay lại True)

Và chỉ (2) đặt lắp ráp trong GAC cho phép ProjectC xây dựng. Tại sao nó không tìm thấy lắp ráp như nó cần (và hiện trên các máy khác)?

+0

Có phải tất cả các máy 64bit hoặc chỉ một điều này? –

+0

Tất cả đều là 64-bit Windows Server 2008 R2 – mundeep

Trả lời

3

Vì vậy, nó quay ra lý do lắp ráp không thể tìm được là vì chúng tôi là Delayed Signing the Assemblies này có nghĩa là:

Because the assembly does not have a valid strong name signature, the verification of that signature must be turned off. You can do this by using the –Vr option with the Strong Name tool.

Tôi đã làm điều này cho tất cả các khóa công khai cần thiết tuy nhiên chỉ trong lệnh x64 Visual Studio lời nhắc. Tôi cũng cần phải thêm bỏ qua xác minh cho x86 trong phiên bản x86 của Visual Studio Command Prompt.

tôi chỉ quản lý để tìm thấy điều này bởi vì cố gắng một lệnh kịch bản dựa trên xây dựng/triển khai cụ thể tôi ghi nhận ngoại lệ sau đây với một trong các hội đồng kiểm tra:

Could not load file or assembly 'ProjectC.Tests, Version=0.0.0.0, Culture=neutral, PublicKeyToken=e72f8d3506b83180' or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A)

3

PublicKeyToken = aaaaaaaaaaaaaaaa có thể khác hoặc có thể là số phiên bản của hội đồng là khác nhau. Tôi nghĩ bạn nên sử dụng Fusion Log Viewer to Debug như được mô tả và hy vọng hoàn toàn bạn sẽ giải quyết được vấn đề của mình.

+1

a) Fusion Log ở trên những gì tôi có thể hiểu được từ nó là nó kiểm tra GAC ​​và sau đó vì một số lý do các thư mục IDE thay vì các thư mục bin dự án. (b) Như đã đề cập ở trên nếu tôi tự đặt assembly ProjectB vào GAC nó được tìm thấy (có nghĩa là khóa là chính xác) - Tôi vừa kiểm tra bằng tay (sn -T) và phím là như nhau. – mundeep

+0

bạn có thể dán phím mà bạn đã kiểm tra bằng (sn-T) và cũng là số phiên bản của assembly. – MMK

+0

Vì vậy, tôi đã loại bỏ các ProjectB dll từ GAC và cố gắng để xây dựng một lần nữa tôi nhận được sau đây trong phản ứng tổng hợp: === Pre-bind state information === LOG: User = DOMAIN \ username LOG: DisplayName = ProjectB, Version = 0.0.0.0, Văn hóa = trung lập, PublicKeyToken = e72f8d3506b83180, bộ vi xử lýArchitecture = MSIL (Được chỉ định đầy đủ) LOG: Appbase = file: /// C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/ .. ... LOG: Tham chiếu sau chính sách: ProjectB, Version = 0.0.0.0, Culture = neutral, PublicKeyToken = e72f8d3506b83180, processorArchitecture = MSIL LOG: Tra cứu GAC không thành công. – mundeep

Các vấn đề liên quan