問題描述
.NET 3.5 解決方案在使用 msbuild 編譯時出現此警告.
A .NET 3.5 solution ended up with this warning when compiling with msbuild.
有時 NDepend 可能會有所幫助,但在這種情況下,它沒有提供任何進一步的細節.像 Bob 我最終不得不求助于打開每個程序集ILDASM 直到我找到引用舊版本依賴程序集的那個.
Sometimes NDepend might help out but in this case it didn't give any further details. Like Bob I ended up having to resort to opening each assembly in ILDASM until I found the one that was referencing an older version of the dependant assembly.
我確實嘗試使用 VS 2010 Beta 2 中的 MSBUILD(因為 Connect 文章指出這已在 CLR 的下一版本中修復),但也沒有提供更多細節(可能在 Beta 2 后修復)
I did try using MSBUILD from VS 2010 Beta 2 (as the Connect article indicated this was fixed in the next version of the CLR) but that didn't provide any more detail either (maybe fixed post Beta 2)
有沒有更好(更自動化)的方法?
Is there a better (more automated) approach?
推薦答案
將MSBuild 項目構建輸出詳細程度"更改為詳細"或以上.為此,請按以下步驟操作:
Change the "MSBuild project build output verbosity" to "Detailed" or above. To do this, follow these steps:
- 打開選項對話框(工具 -> 選項...).
- 在左側樹中,選擇 Projects and Solutions 節點,然后選擇 Build and Run.
- 注意:如果此節點未顯示,請確保對話框底部的復選框顯示所有設置已選中.
- Bring up the Options dialog (Tools -> Options...).
- In the left-hand tree, select the Projects and Solutions node, and then select Build and Run.
- Note: if this node doesn't show up, make sure that the checkbox at the bottom of the dialog Show all settings is checked.
在出現的工具/選項頁面中,根據您的版本將 MSBuild 項目構建輸出詳細程度 級別設置為適當的設置:
In the tools/options page that appears, set the MSBuild project build output verbosity level to the appropriate setting depending on your version:
- 診斷在 VS2012、VS2013 或 VS2015 上時(這些版本中的消息說您應該使用詳細",但這是完全錯誤的,您應該使用診斷")
- 詳解當你在 VS2010 上時
- 普通在 VS2008 或更早版本中就足夠了.
- Diagnostics when on VS2012, VS2013 or VS2015 (the message in these versions says you should use "Detailed", but this is plain wrong, you should use "Diagnostics")
- Detailed when you're on VS2010
- Normal will suffice in VS2008 or older.
查看 MSBuild 消息.ResolveAssemblyReferences
任務是 MSB3247 的起源任務,應該可以幫助您調試此特定問題.
Check out the MSBuild messages. The ResolveAssemblyReferences
task, which is the task from which MSB3247 originates, should help you debug this particular issue.
我的具體情況是對 SqlServerCe 的錯誤引用.見下文.我有兩個項目引用了兩個不同版本的 SqlServerCe.我去了舊版本的項目,刪除了引用,然后添加了正確的引用.
My specific case was an incorrect reference to SqlServerCe. See below. I had two projects referencing two different versions of SqlServerCe. I went to the project with the older version, removed the reference, then added the correct reference.
Target ResolveAssemblyReferences:
Consider app.config remapping of assembly "System.Data.SqlServerCe, ..."
from Version "3.5.1.0" [H:...DebugSystem.Data.SqlServerCe.dll]
to Version "9.0.242.0" [C:Program FilesMicrosoft Visual Studio 8Common7IDEPublicAssembliesSystem.Data.SqlServerCe.dll]
to solve conflict and get rid of warning.
C:WINDOWSMicrosoft.NETFrameworkv3.5Microsoft.Common.targets :
warning MSB3247: Found conflicts between different versions of the same dependent assembly.
<小時>
您不必打開每個程序集來確定引用程序集的版本.
You do not have to open each assembly to determine the versions of referenced assemblies.
- 您可以檢查每個參考的屬性.
- 打開項目屬性并檢查參考部分的版本.
- 使用文本編輯器打開項目.
- 使用 .Net Reflector.
這篇關于解決 MSB3247 - 發現同一依賴程序集的不同版本之間存在沖突的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!