Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
VCCodeModel Interface

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)

public interface class VCCodeModel : CodeModel2
/** @attribute GuidAttribute("DF69B05F-2447-11D7-8BF6-00B0D03DAA06") */ 
public interface VCCodeModel extends CodeModel2
public interface VCCodeModel extends 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.


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.

See Samples for 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
        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
                GetVCCodeModel = vcCodeModel
            End If
        End If
    End If
End Function
© 2015 Microsoft