Freigeben über


SolutionFolder.Hidden-Eigenschaft

Legt das Attribut zum Ausblenden der Projektmappe fest oder ruft es ab.

Namespace:  EnvDTE80
Assembly:  EnvDTE80 (in EnvDTE80.dll)

Syntax

'Declaration
Property Hidden As Boolean
bool Hidden { get; set; }
property bool Hidden {
    bool get ();
    void set (bool value);
}
abstract Hidden : bool with get, set
function get Hidden () : boolean 
function set Hidden (value : boolean)

Eigenschaftswert

Typ: Boolean
Bestimmt, ob eine Projektmappe im Projektmappen-Explorer ausgeblendet wird.

Beispiele

In diesem Beispiel wird ein neuer Projektmappenordner erstellt und ihm aus einer vorhandenen Datei ein Projekt hinzugefügt. Außerdem wird dem ersten Projektmappenordner mithilfe der AddSolutionFolder-Methode ein neuer, geschachtelter Projektmappenordner hinzugefügt. Anschließend wird die Hidden-Eigenschaft angezeigt und auf false festgelegt. Erstellen Sie vor dem Ausführen des Beispiels auf dem Hauptlaufwerk (in diesem Beispiel "C:") den Ordner "Projects" sowie in diesem Ordner ein Visual C#-Klassenbibliotheksprojekt mit dem Namen "ClassLibrary1". Öffnen Sie vor dem Ausführen des Add-Ins in der integrierten Visual Studio-Entwicklungsumgebung (Integrated Development Environment – IDE) ein Projekt.

Weitere Informationen zum Ausführen dieses Beispiels als Add-In finden Sie unter Gewusst wie: Kompilieren und Ausführen der Codebeispiele für das Automatisierungsobjektmodell.

Imports EnvDTE
Imports EnvDTE80
Public Sub OnConnection(ByVal application As Object, _
 ByVal connectMode As ext_ConnectMode, ByVal addInInst As Object, _
 ByRef custom As Array) Implements IDTExtensibility2.OnConnection
    _applicationObject = CType(application, DTE2)
    _addInInstance = CType(addInInst, AddIn)
    solnFolderHiddenExample(_applicationObject)
End Sub
Sub solnFolderHiddenExample(ByVal dte As DTE2)
    ' Before running this example, create a "Projects" folder
    ' off your main drive (C: in this example), and create a C# 
    ' class library project named ClassLibrary1 in that folder.
    Dim soln As Solution2 = CType(_applicationObject.Solution _
    , Solution2)
    Dim prj As Project
    Dim SF As SolutionFolder
    Try
        Dim prjPath As String = _
        "C:\Projects\ClassLibrary1\ClassLibrary1\ClassLibrary1.csproj"
        ' Open a project in the Visual Studio IDE before 
        ' running this add-in.
        ' Add a solution folder.
        prj = soln.AddSolutionFolder("A new soln folder")
        SF = CType(prj.Object, SolutionFolder)
        ' Add a project to the new solution folder.
        SF.AddFromFile(prjPath)
        MsgBox("Added a new solution folder that contains  _
        a C# project named ClassLibrary1.")
        SF.AddSolutionFolder("New solnFolder2")
        MsgBox("Added a new solution folder _
        named 'New solnFolder2'.")
        MsgBox("The Hidden property value is set to: "  _
        & SF.Hidden.ToString())
        MsgBox("Set the 'Hidden' property to 'False'.")
        SF.Hidden = False
    Catch ex As System.Exception
        MsgBox(ex.ToString)
    End Try
End Sub
using EnvDTE;
using EnvDTE80;
using System.Windows.Forms;
public void OnConnection(object application, 
ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
    _applicationObject = (DTE2)application;
    _addInInstance = (AddIn)addInInst;
    solnFolderHiddenExample(_applicationObject);
}
public void solnFolderHiddenExample(DTE2 dte)
{
    // Before running this example, create a "Projects" folder
    // off your main drive (C: in this example), and create a C# 
    // class library project, named ClassLibrary1 in that folder.
    Solution2 soln = (Solution2)_applicationObject.Solution;
    Project prj;
    SolutionFolder SF;
    try
    {
        String prjPath = 
"C:\\Projects\\ClassLibrary1\\ClassLibrary1\\ClassLibrary1.csproj";
        // Open a project in Visual Studio IDE before 
        // running this add-in.
        // Add a solution folder.
        prj = soln.AddSolutionFolder("A new soln folder");
        SF = (SolutionFolder)prj.Object;
        // Add a project to the new solution folder.
        SF.AddFromFile(prjPath);
        MessageBox.Show("Added a new solution folder that 
contains a C# project named ClassLibrary1.");
        SF.AddSolutionFolder("New solnFolder2");
        MessageBox.Show("Added a new solution folder 
named 'New solnFolder2'.");
        MessageBox.Show("The Hidden property value is set to: " 
+ SF.Hidden.ToString());
        MessageBox.Show("Set the 'Hidden' property to 'false'.");
        SF.Hidden = false;
    }
    catch(SystemException ex)
    {
    MessageBox.Show(ex.ToString());
    }
}

.NET Framework-Sicherheit

Siehe auch

Referenz

SolutionFolder Schnittstelle

EnvDTE80-Namespace