Share via


SolutionFolder.Hidden Property

Definition

Sets or gets the hidden attribute of the solution.

public:
 property bool Hidden { bool get(); void set(bool value); };
public:
 property bool Hidden { bool get(); void set(bool value); };
[System.Runtime.InteropServices.DispId(6)]
public bool Hidden { [System.Runtime.InteropServices.DispId(6)] get; [System.Runtime.InteropServices.DispId(6)] set; }
[<System.Runtime.InteropServices.DispId(6)>]
[<get: System.Runtime.InteropServices.DispId(6)>]
[<set: System.Runtime.InteropServices.DispId(6)>]
member this.Hidden : bool with get, set
Public Property Hidden As Boolean

Property Value

Determines if a solution is hidden from view in the solution explorer.

Attributes

Examples

This example creates a new solution folder and adds a project to it from an existing file. It also adds a new nested solution folder to the first one, by using the AddSolutionFolder method and then displays the Hidden property and sets it to false. Before running this example, create a "Projects" folder off your main drive ("C:" in this example), and create a Visual C# class library project named "ClassLibrary1" in that folder. Open a project in the Visual Studio integrated development environment (IDE) before running this example.

Imports EnvDTE  
Imports EnvDTE80  
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 example.  
        ' 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 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 example.  
        // 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());  
    }  
}  

Applies to