Posted By

slolife on 03/29/12


Tagged

VBNet c# vsnet


Versions (?)

Find all TreatWarningsAsErrors=false projects


 / Published in: VB.NET
 

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

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

  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

Report this snippet  

You need to login to post a comment.