我試圖讓VS將下列警告視爲錯誤。我沒有取得任何成功,既沒有具體的警告,也沒有任何警告(在項目選項中)。將警告視爲錯誤
輸出
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1490,5): warning MSB3247: Found conflicts between different versions of the same dependent assembly.
錯誤列表
Warning 1 Found conflicts between different versions of the same dependent assembly.
我試圖解決的問題是這樣的:MyApp的引用力霸V1和V1 LibB。 LibB v1引用了LibA v2。起初沒有關於版本差異的通知。簽署組件會給出警告。如果可能的話,我想把它看成是一個錯誤,因爲這些會比注意到的警告快得多。
更新 在與菲爾的答案工作後,我現在使用這個宏。可能爲此做一個插件,但我現在沒有時間這樣做。
Private Sub BuildEvents_OnBuildDone(ByVal Scope As EnvDTE.vsBuildScope, ByVal Action As EnvDTE.vsBuildAction) Handles BuildEvents.OnBuildDone
' Create a tool window handle for the Output window.
Dim win As Window = DTE.Windows.Item(EnvDTE.Constants.vsWindowKindOutput)
' Create handles to the Output window and its panes.
Dim OW As OutputWindow = win.Object
OW.ActivePane.TextDocument.Selection.SelectAll()
If OW.ActivePane.TextDocument.Selection.Text.Contains("MSB3247") Then
System.Windows.Forms.MessageBox.Show("Found conflicts between different versions of the same dependent assembly.", "warning MSB3247")
End If
End Sub
VS的什麼版本? – Connell
我試圖在VS2010中,但我也使用VS2008的WinCE項目。 – Stijn