Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

VCCodeModel Interface

An object providing project-level access to any contained code element.

Namespace:  Microsoft.VisualStudio.VCCodeModel
Assembly:  Microsoft.VisualStudio.VCCodeModel (in Microsoft.VisualStudio.VCCodeModel.dll)

[GuidAttribute("DF69B05F-2447-11D7-8BF6-00B0D03DAA06")]
public interface VCCodeModel : CodeModel2

The VCCodeModel object provides code model functionality to various languages supported by Visual Studio (including Visual C++) at the project level.

Primarily, this object is used to find any code element accessible within a project (given a fully-qualified name). In addition, the object specifies the programming language in which the project is written.

NoteNote:

A large part of the functionality of this object is provided by the Visual Studio CodeModel2 object.

When using a VCCodeModel object within a managed project, include Microsoft.VisualStudio.VCCodeModel.dll as a reference. For more information about adding references to a managed project, see How to: Add or Remove References in Visual Studio (Visual Basic).

See How to: Compile Example Code for Visual C++ Code Model Extensibility for information about how to compile and run this sample.

This function returns the VCCodeModel object representing the first project in a solution.

Function GetVCCodeModel() As VCCodeModel
    GetVCCodeModel = Nothing
    Dim codeModel As CodeModel
    Dim vcCodeModel As VCCodeModel
    Dim solution As Solution
    solution = DTE.Solution
    If (solution Is Nothing) Then
        MsgBox("A Solution is not open")
        Exit Function
    Else
        If (DTE.Solution.Count <> 0) Then
            codeModel = DTE.Solution.Item(1).CodeModel
            vcCodeModel = CType(codeModel, VCCodeModel)
            If (vcCodeModel Is Nothing) Then
                MsgBox("The first project is not a VC++ project.")
                Exit Function
            Else
                GetVCCodeModel = vcCodeModel
            End If
        End If
    End If
End Function
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft