![](/img/trans.png)
[英]Found conflicts between different versions of "Microsoft.CSharp" that could not be resolved
[英]Understanding build log for “Found conflicts between different versions of ”Microsoft.WindowsAzure.Storage“ that could not be resolved.”
Visual Studio 2017(15.5.4)的構建日志讓我對如何擺脫警告感到困惑
發現無法解決的“Microsoft.WindowsAzure.Storage”的不同版本之間的沖突。 當日志詳細程度設置為詳細時,這些引用沖突將在構建日志中列出。 Animals.Swine.Functions C:\\ Program Files(x86)\\ Microsoft Visual Studio \\ 2017 \\ Enterprise \\ MSBuild \\ 15.0 \\ Bin \\ Microsoft.Common.CurrentVersion.targets
There was a conflict between "Microsoft.WindowsAzure.Storage, Version=7.2.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" and "Microsoft.WindowsAzure.Storage, Version=8.1.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35".
"Microsoft.WindowsAzure.Storage, Version=7.2.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" was chosen because it was primary and "Microsoft.WindowsAzure.Storage, Version=8.1.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" was not.
References which depend on "Microsoft.WindowsAzure.Storage, Version=7.2.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" [D:\Repos\Animals\src\Animals.Swine\packages\WindowsAzure.Storage.7.2.1\lib\net40\Microsoft.WindowsAzure.Storage.dll].
D:\Repos\Animals\src\Animals.Swine\packages\WindowsAzure.Storage.7.2.1\lib\net40\Microsoft.WindowsAzure.Storage.dll
Project file item includes which caused reference "D:\Repos\Animals\src\Animals.Swine\packages\WindowsAzure.Storage.7.2.1\lib\net40\Microsoft.WindowsAzure.Storage.dll".
Microsoft.WindowsAzure.Storage, Version=7.2.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL
References which depend on "Microsoft.WindowsAzure.Storage, Version=8.1.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" [].
D:\Repos\Animals\src\Animals.Common\Animals.Common.Functions\bin\Debug\net461\bin\Animals.Common.Functions.dll
Project file item includes which caused reference "D:\Repos\Animals\src\Animals.Common\Animals.Common.Functions\bin\Debug\net461\bin\Animals.Common.Functions.dll".
D:\Repos\Animals\src\Animals.Common\Animals.Common.Functions\bin\Debug\net461\bin\Animals.Common.Functions.dll
D:\Repos\Animals\src\packages\Microsoft.Azure.WebJobs.2.1.0\lib\net45\Microsoft.Azure.WebJobs.Host.dll
Project file item includes which caused reference "D:\Repos\Animals\src\packages\Microsoft.Azure.WebJobs.2.1.0\lib\net45\Microsoft.Azure.WebJobs.Host.dll".
Microsoft.Azure.WebJobs.Host, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL
Microsoft.Azure.WebJobs.Extensions, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL
D:\Repos\Animals\src\Animals.Common\Animals.Common\bin\Debug\net45\Animals.Common.dll
Project file item includes which caused reference "D:\Repos\Animals\src\Animals.Common\Animals.Common\bin\Debug\net45\Animals.Common.dll".
D:\Repos\Animals\src\Animals.Swine\Animals.Swine\bin\Debug\Animals.Swine.dll
D:\Repos\Animals\src\Animals.Common\Animals.Common\bin\Debug\net45\Animals.Common.dll
D:\Repos\Animals\src\Animals.Swine\packages\Microsoft.Azure.WebJobs.Extensions.2.0.0\lib\net45\Microsoft.Azure.WebJobs.Extensions.dll
Project file item includes which caused reference "D:\Repos\Animals\src\Animals.Swine\packages\Microsoft.Azure.WebJobs.Extensions.2.0.0\lib\net45\Microsoft.Azure.WebJobs.Extensions.dll".
Microsoft.Azure.WebJobs.Extensions, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL
如果我們瀏覽一下據稱使用Storage 8.1.1.0的引用,我們會看到第一個,第三個和最后一個引用它們。 為什么會這么想? 那有什么意思?
D:\Repos\Animals\src\Animals.Common\Animals.Common.Functions\bin\Debug\net461\bin\Animals.Common.Functions.dll
Project file item includes which caused reference "D:\Repos\Animals\src\Animals.Common\Animals.Common.Functions\bin\Debug\net461\bin\Animals.Common.Functions.dll".
D:\Repos\Animals\src\Animals.Common\Animals.Common.Functions\bin\Debug\net461\bin\Animals.Common.Functions.dll
...
D:\Repos\Animals\src\Animals.Common\Animals.Common\bin\Debug\net45\Animals.Common.dll
Project file item includes which caused reference "D:\Repos\Animals\src\Animals.Common\Animals.Common\bin\Debug\net45\Animals.Common.dll".
D:\Repos\Animals\src\Animals.Swine\Animals.Swine\bin\Debug\Animals.Swine.dll
D:\Repos\Animals\src\Animals.Common\Animals.Common\bin\Debug\net45\Animals.Common.dll
D:\Repos\Animals\src\Animals.Swine\packages\Microsoft.Azure.WebJobs.Extensions.2.0.0\lib\net45\Microsoft.Azure.WebJobs.Extensions.dll
Project file item includes which caused reference "D:\Repos\Animals\src\Animals.Swine\packages\Microsoft.Azure.WebJobs.Extensions.2.0.0\lib\net45\Microsoft.Azure.WebJobs.Extensions.dll".
Microsoft.Azure.WebJobs.Extensions, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL
第二個似乎是一個更好的檢查和討論的地方:
D:\Repos\Animals\src\packages\Microsoft.Azure.WebJobs.2.1.0\lib\net45\Microsoft.Azure.WebJobs.Host.dll
Project file item includes which caused reference "D:\Repos\Animals\src\packages\Microsoft.Azure.WebJobs.2.1.0\lib\net45\Microsoft.Azure.WebJobs.Host.dll".
Microsoft.Azure.WebJobs.Host, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL
Microsoft.Azure.WebJobs.Extensions, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL
因此,如果我正確閱讀, Microsoft.Azure.WebJobs.Host, Version=2.1.0.0
和Microsoft.Azure.WebJobs.Extensions, Version=2.0.0.0
都應該引用Microsoft.WindowsAzure.Storage, Version=8.1.1.0
。 但是,如果我們查看Nuget依賴項, WebJobs引用7.2.1.0
和WebJobs.Extensions只是引用回[WebJobs]。
我沒有看到任何引用8.1.1.0
! 任何項目都不直接引用存儲,我看不到間接引用。
我在“D:\\ Repos \\ Animals \\ src \\ Animals.Swine \\ Animals.Swine.Functions \\ bin \\”上運行AsmSpy,但它甚至沒有顯示存儲沖突。
如何確定Storage 8.1.1.0引用的來源?
更新:我進行了文本搜索,發現綁定重定向設置為“8.1.1.0”作為newVersion。 我將其更改為“7.2.1.0”並且警告消失了。 即使警告已經消失,我仍然會打開這個問題,以便有人能夠深入了解如何閱讀構建日志以及日志如何指向正確的方向。
如何確定Storage 8.1.1.0引用的來源?
構建日志可以幫助我們解決大多數問題,但它不能解決所有問題。 它仍然需要我們手動解決這些問題。 因為Visual Studio / MSBuild無法直接找到問題的根本原因。
當我們遇到此MSB3247 / MSB3277錯誤時,解決此問題的最佳方法是將MSBuild輸出日志轉為Diagnostic ( 工具 - >選項 - >項目和解決方案 - >構建和運行,設置MSBuild項目構建輸出詳細程度 ),然后找到依賴於Microsoft.WindowsAzure.Storage
引用,檢查是否有不同版本的Microsoft.WindowsAzure.Storage
被引用。
在構建日志中,我們發現Project文件項包括哪些引起了參考Microsoft.Azure.WebJobs.2.1.0
和Microsoft.Azure.WebJobs.Extensions.2.0.0
然后檢查這兩個包的依賴關系,它們都沒有引用Microsoft.WindowsAzure.Storage, Version=8.1.1.0
。
為了確認它,您可以使用Vladimir在評論中提供的方法。
此時此沖突不應來自參考。 然后我們應該檢查與參考版本相關的文件,例如app.confi
g或web.config
,找到關於引用Microsoft.WindowsAzure.Storage
綁定重定向,檢查綁定重定向是否正確。
所以有時我們不能僅僅根據構建日志信息直接解決問題,手動故障排除也是必不可少的。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.