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)
Syntax
<GuidAttribute("DF69B05F-2447-11D7-8BF6-00B0D03DAA06")> _
Public Interface VCCodeModel _
Implements CodeModel2
Dim instance As VCCodeModel
[GuidAttribute("DF69B05F-2447-11D7-8BF6-00B0D03DAA06")]
public interface VCCodeModel : CodeModel2
[GuidAttribute(L"DF69B05F-2447-11D7-8BF6-00B0D03DAA06")]
public interface class VCCodeModel : CodeModel2
public interface VCCodeModel extends CodeModel2
Remarks
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.
Nota
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.
Examples
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