Compartir a través de


ProjectItem.ContainingProject (Propiedad)

Obtiene el proyecto que hospeda ProjectItem.

Espacio de nombres:  EnvDTE
Ensamblado:  EnvDTE (en EnvDTE.dll)

Sintaxis

'Declaración
ReadOnly Property ContainingProject As Project
    Get
Project ContainingProject { get; }
property Project^ ContainingProject {
    Project^ get ();
}
abstract ContainingProject : Project
function get ContainingProject () : Project

Valor de propiedad

Tipo: EnvDTE.Project
Un objeto Project.

Ejemplos

Sub ContainingProjectExample(ByVal dte As DTE2)

    ' Before running this example, open a code document from a project.
    Try
        ' Create a new namespace.
        Dim projItem As ProjectItem = dte.ActiveDocument.ProjectItem
        Dim cm As CodeModel = projItem.ContainingProject.CodeModel
        cm.AddNamespace("TestNamespace", projItem.Name)
    Catch ex As Exception
        MsgBox(ex.Message)
    End Try

End Sub
public void ContainingProjectExample(DTE2 dte)
{
    // Before running this example, open a code document from 
    // a project.
    try
    {
        // Create a new namespace.
        ProjectItem projItem = dte.ActiveDocument.ProjectItem;
        CodeModel cm = projItem.ContainingProject.CodeModel;
        cm.AddNamespace("TestNamespace", projItem.Name, -1);
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}

Seguridad de .NET Framework

Vea también

Referencia

ProjectItem Interfaz

EnvDTE (Espacio de nombres)

Otros recursos

Cómo: Compilar y ejecutar los ejemplos de código del modelo de objetos de automatización