2011-10-27 26 views
7

Tôi có một ứng dụng tham chiếu đến assembly này trong môi trường phát triển:chuyển hướng Binding thất bại - PublicKeyToken khác nhau

name="Microsoft.Data.SqlXml" culture="neutral" publicKeyToken="89845dcd8080cc91" version="9.0.242.0" 

Tuy nhiên, máy chủ trực tiếp chứa phiên bản cũ của thư viện này:

name="Microsoft.Data.SqlXml" culture="neutral" publicKeyToken="b77a5c561934e089" version="3.2.2917.0" 

Như bạn thấy PublicKeyToken khác. Tôi đã thêm bindingRedirect để app.config:

<runtime> 
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 
     <dependentAssembly> 
      <assemblyIdentity name="Microsoft.Data.SqlXml" culture="neutral" publicKeyToken="89845dcd8080cc91" /> 
      <bindingRedirect oldVersion="9.0.242.0" newVersion="3.2.2917.0"/> 
     </dependentAssembly> 
    </assemblyBinding> 
</runtime> 

nhưng tôi vẫn nhận được lỗi:

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or ass embly 'Microsoft.Data.SqlXml, Version=3.2.2917.0, Culture=neutral, PublicKeyToke n=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified. File name: 'Microsoft.Data.SqlXml, Version=3.2.2917.0, Culture=neutral, PublicKe yToken=89845dcd8080cc91' ---> System.IO.FileNotFoundException: Could not load fi le or assembly 'Microsoft.Data.SqlXml, Version=9.0.242.0, Culture=neutral, Publi cKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find t he file specified. File name: 'Microsoft.Data.SqlXml, Version=9.0.242.0, Culture=neutral, PublicKey Token=89845dcd8080cc91'

Có cách nào để chuyển hướng đến phiên bản cũ của thư viện trong trường hợp đó?

Trả lời

8

Bạn không thể chuyển hướng hội đồng nếu khóa công khai khác với tôi, bạn sẽ cần phải biên dịch lại phiên bản cũ hơn và xóa chuyển hướng.

+0

Cảm ơn, đây là những gì tôi làm hàng ngày. Tôi thay đổi tham chiếu đến hội đồng cũ trước khi phát hành trực tiếp. Đó là một sự xấu hổ. Cảm ơn. – dragonfly

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