C# 引用DLL版本衝突

來源:互聯網
上載者:User

標籤:產生   wrap   data-   dex   target   技術分享   解決   http   code   

已解決,到官網上下載舊key版本,然後再重新導向即可。

手動引用兩個版本的DLL錯誤的原因是我 publicKeyToken 大小寫問題(竟然沒校正~~)

但我想不明白,這樣搞如果依賴一多的話,甚至那個 publicKeyToken 都不統一的話,那管理起來不是會特別麻煩嗎?

以下是原問題內容:

工程中要用到zookeeper,他依賴一個低版本的log4net,但是我想用高版本的log4net。

百度後發現可以使用 重新導向程式集版本 來解決,但是實踐後發現兩個版本的 PublicKeyToken 還不一樣!

這種情況該怎麼辦?只能拉代碼重建一個嗎?

再次嘗試手動引用兩個版本的DLL,其中一個用別名。

app.config 中增加 dependentAssembly

  <dependentAssembly>      <assemblyIdentity name="log4net" publicKeyToken="1b44e1d426115821" culture="neutral" />    ??<codeBase version="1.2.10.0" href="DLL/log4net_1.2.10.dll" />  </dependentAssembly>  <dependentAssembly>    ??<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" />    ??<codeBase version="2.0.8.0" href="DLL/log4net_2.0.8.0.dll" />  </dependentAssembly>

編譯時間候報:

warning MSB3243: 無法解決“log4net, Version=2.0.8.0, Culture=neutral,
PublicKeyToken=669e0ddf0bb1aa2a”與“log4net, Version=1.2.10.0,
Culture=neutral, PublicKeyToken=1b44e1d426115821”之間的衝突。正在隨意選擇“log4net,
Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a”。

啟動報:


C# 引用DLL版本衝突 >> csharp

這個答案描述的挺清楚的:
http://www.goodpm.net/postreply/csharp/1010000008923000/C引用DLL版本衝突.html

C# 引用DLL版本衝突

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.