Find all TreatWarningsAsErrors=false projects


/ Published in: VB.NET
Save to your folder(s)

VS.NET Macro to list all projects in current solution that have TreatWarningsAsErrors=false.


Copy this code and paste it in your HTML
  1. Sub ScanProjectsForTreatWarningsAsErrors()
  2. Const PaneName As String = "TreatWarningsAsErrors"
  3. Dim ow As OutputWindow = DTE.ToolWindows.OutputWindow
  4. Dim owp As OutputWindowPane = ow.OutputWindowPanes.Item(PaneName)
  5. If owp Is Nothing Then
  6. owp = ow.OutputWindowPanes.Add(PaneName)
  7. End If
  8.  
  9. owp.Clear()
  10. owp.Activate()
  11.  
  12. For Each project As Project In DTE.Solution.Projects
  13. ScanProject(project, owp)
  14. Exit For
  15. Next
  16. End Sub
  17.  
  18. Sub ScanProject(ByVal project As Project, ByVal owp As OutputWindowPane)
  19. If (project.Kind = "{66A26720-8FB5-11D2-AA7E-00C04F688DDE}") Then
  20. For Each projectItem As ProjectItem In project.ProjectItems
  21. If Not (projectItem.SubProject Is Nothing) Then
  22. ScanProject(projectItem.SubProject, owp)
  23. End If
  24. Next
  25. Else
  26. For Each config As Configuration In project.ConfigurationManager
  27. Dim value As Boolean = CType(config.Properties.Item("TreatWarningsAsErrors").Value, Boolean)
  28. If Not value Then
  29. owp.OutputString("Project: " + project.Name + ", " + config.ConfigurationName)
  30. owp.OutputString(" - TreatWarningsAsErrors = " + value.ToString())
  31. owp.OutputString(vbCrLf)
  32. End If
  33. Next
  34.  
  35. 'For Each configProp As [Property] In project.ConfigurationManager.Item(1).Properties
  36. ' owp.OutputString(configProp.Name + vbCrLf)
  37. 'Next
  38. End If
  39. End Sub

URL: http://www.onlinescorekeeper.com/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.