I have an Extension to Visual Studio 2015 that needs to Iterate through codeElements in a ProjectItem. I check to see if ProjectItem has a FileCodeModel as shown below.
If ProjectItem.FileCodeModel Is Nothing Then
g_objTrace.LogTrace(String.Format("{0} does not have FileCodeModel to determine its members.", getProjectItemFileName(ProjectItem)))
Else
CodeElements = ProjectItem.FileCodeModel.CodeElements
If CodeElements IsNot Nothing Then
For Each CodeElement In CodeElements
' Load all the elements in the projectitem
Call WalkCodeElements(parentNode, ProjectItem, CodeElement)
Next
End If
End If
For a lot of Projects that I tested FileCodeModel is NOT Nothing but for some it is. For example, I downloaded Roslyn and for ALL projectItems FileCodeModel is ALWAYS nothing.
Any ideas?
Is there an another way to enumerate code elements in VS 2015?