2012-11-27 39 views
6

Tôi có một ứng dụng giao diện điều khiển C# dự án phụ thuộc vào NHibernate 3.3.2 và ShapArch.NHibernate 2.0.4.628 đã được biên dịch với NHibernate 3.3.1 (theo như tôi biết - tôi có thể sai, nhưng khi tôi tạo một dự án 2.0.4 SharpArch nó đã tải về NH 3.3.1 qua Nuget).dll phiên bản được hiển thị trong studio trực quan .Net không phản ánh tệp dll được tham chiếu/phiên bản sản phẩm

Tại sao Visual Studio hiển thị NHibernate làm phiên bản 3.3.1.4000 khi dll được tham chiếu là 3.3.2.4000? Thuộc tính Phiên bản Cụ thể được đặt thành false cho tất cả các tham chiếu. Và phiên bản cho SharpArch xuất hiện trong VS 2.0.0.0 thay vì 2.0.4 là phiên bản tệp/sản phẩm.

Trong cấu hình ứng dụng Tôi có:

<runtime> 
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 
    <dependentAssembly> 
     <assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" /> 
     <bindingRedirect oldVersion="0.0.0.0-3.3.1.4000" newVersion="3.3.2.4000" /> 
    </dependentAssembly> 
    </assemblyBinding> 
</runtime> 

Ứng dụng không tải với:

System.IO.FileLoadException was unhandled 
    Message=Could not load file or assembly 'NHibernate, Version=3.3.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) 
    Source=MyApp.ResourcesGenerator 
    FileName=NHibernate, Version=3.3.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4 
    FusionLog="" 
    StackTrace: 
     at MyApp.ResourcesGenerator.Program.InitializeNHibernateSession() 
     at SharpArch.NHibernate.NHibernateInitializer.InitializeNHibernateOnce(Action initMethod) in d:\Builds\SharpArch2\Solutions\SharpArch.NHibernate\NHibernateInitializer.cs:line 54 
     at MyApp.ResourcesGenerator.Program.Initialize() in C:\projects\tc\Trunk\Source_LibsUpgrade\Applications\PerformanceManagement\MyApp.ResourcesGenerator\Program.cs:line 149 
     at MyApp.ResourcesGenerator.Program.Main(String[] args) in C:\projects\tc\Trunk\Source_LibsUpgrade\Applications\PerformanceManagement\MyApp.ResourcesGenerator\Program.cs:line 31 
     at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) 
     at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() 
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) 
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 
     at System.Threading.ThreadHelper.ThreadStart() 
    InnerException: System.IO.FileLoadException 
     Message=Could not load file or assembly 'NHibernate, Version=3.3.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) 
     FileName=NHibernate, Version=3.3.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4 

Tôi thậm chí không chắc chắn lý do tại sao nó đang cố gắng để tải 3.3.0.4000 khi kiến ​​trúc sắc nét đã được được biên dịch với 3.3.1.

Trả lời

11

NHibernate 3.3.2.GA có tệp phiên bản 3.3.2.4000 nhưng phiên bản vẫn còn 3.3.1.4000. Điều này đã được thực hiện để cho phép nâng cấp NHibernate mà không cần chuyển hướng ràng buộc. Tất cả các bản nâng cấp phiên bản nhỏ trong tương lai của NHibernate cũng sẽ tuân theo mẫu này.

Vì vậy, giải pháp cho bạn chỉ là xóa chuyển hướng ràng buộc.

Phần khó hiểu ở đây là Windows Explorer chỉ hiển thị phiên bản tệp và sản phẩm nhưng Visual Studio chỉ hiển thị phiên bản lắp ráp.

+3

Mong muốn ai đó sẽ tạo tiện ích mở rộng VS để hiển thị phiên bản tệp trong danh sách thuộc tính. –

+0

Hiện tại tôi sẽ luôn sử dụng bộ phản xạ .net luôn hiển thị phiên bản cũng như các phiên bản của dll mà dll phụ thuộc vào – costa

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