Share via


VSProject, interface

Contient les informations propres à un projet Visual Basic ou C#. Il est retourné par l'objet Object lorsque le projet est un projet Visual Basic, Visual C# ou Visual J#.

Espace de noms: VSLangProj
Assembly : VSLangProj (dans vslangproj.dll)

Syntaxe

'Déclaration
<GuidAttribute("2CFB826F-F6BF-480D-A546-95A0381CC411")> _
Public Interface VSProject
'Utilisation
Dim instance As VSProject
[GuidAttribute("2CFB826F-F6BF-480D-A546-95A0381CC411")] 
public interface VSProject
[GuidAttribute(L"2CFB826F-F6BF-480D-A546-95A0381CC411")] 
public interface class VSProject
/** @attribute GuidAttribute("2CFB826F-F6BF-480D-A546-95A0381CC411") */ 
public interface VSProject
GuidAttribute("2CFB826F-F6BF-480D-A546-95A0381CC411") 
public interface VSProject

Notes

Project est un objet d'extensibilité principale pouvant contenir des informations sur des projets, quel que soit leur langage. Object de l'objet Project retourne un objet dont le type est déterminé par le langage du projet. Dans le cas de Visual Basic, Visual C# et Visual J#, il s'agit d'un objet VSProject.

Object retourne un type de données Object. L'objet de données retourné par Object peut ensuite être explicitement converti en objet VSProject. L'exemple ci-après montre comment cette conversion est effectuée à l'aide de la fonction CType. PrjKind est utilisé pour tester le type du projet avant la conversion.

Exemple

' Macro Editor
' This example retrieves the VSProject object if the first project
' the solution is a Visual Basic or C# project. This routine assumes
' that the solution contains at least one project.
Imports VSLangProj
Sub VSProjectExample()
   Dim aProject As Project
   Dim aVSProject As VSProject
        
   aProject = DTE.Solution.Projects.Item(1)
   If (aProject.Kind = PrjKind.prjKindVBProject) _
   Or (aProject.Kind = PrjKind.prjKindCSharpProject) Then
      aVSProject = CType(DTE.Solution.Projects.Item(1).Object, VSProject)
      MsgBox(aVSProject.Project.FullName)
   Else
      MsgBox("The first project is not a Visual Basic or C# project.")
   End If
End Sub

Voir aussi

Référence

Membres VSProject
VSLangProj, espace de noms