Partager via


ProvideProfileAttribute Constructor

Initializes a new instance of ProvideProfileAttribute.

Namespace:  Microsoft.VisualStudio.Shell
Assembly:  Microsoft.VisualStudio.Shell.12.0 (in Microsoft.VisualStudio.Shell.12.0.dll)

Syntax

'Declaration
Public Sub New ( _
    objectType As Type, _
    categoryName As String, _
    objectName As String, _
    categoryResourceID As Short, _
    objectNameResourceID As Short, _
    isToolsOptionPage As Boolean _
)
public ProvideProfileAttribute(
    Type objectType,
    string categoryName,
    string objectName,
    short categoryResourceID,
    short objectNameResourceID,
    bool isToolsOptionPage
)
public:
ProvideProfileAttribute(
    Type^ objectType, 
    String^ categoryName, 
    String^ objectName, 
    short categoryResourceID, 
    short objectNameResourceID, 
    bool isToolsOptionPage
)
new : 
        objectType:Type * 
        categoryName:string * 
        objectName:string * 
        categoryResourceID:int16 * 
        objectNameResourceID:int16 * 
        isToolsOptionPage:bool -> ProvideProfileAttribute
public function ProvideProfileAttribute(
    objectType : Type, 
    categoryName : String, 
    objectName : String, 
    categoryResourceID : short, 
    objectNameResourceID : short, 
    isToolsOptionPage : boolean
)

Parameters

  • objectType
    Type: Type

    The Type of the class implementing Visual Studio settings support.

  • categoryName
    Type: String

    The canonical, nonlocalized name of a Visual Studio settings category.

  • objectName
    Type: String

    The canonical, nonlocalized name used to identify the object implementing a Visual Studio settings category.

  • categoryResourceID
    Type: Int16

    The localized resource ID of a Visual Studio settings category's name.

  • objectNameResourceID
    Type: Int16

    The localized resource ID of the name used to identify the object implementing a Visual Studio settings category.

  • isToolsOptionPage
    Type: Boolean

    This argument is not implemented.

Remarks

The ProvideProfileAttribute constructor uses the GUID obtained from objectType to uniquely identify a Custom Settings Point's Visual Studio settings category.

If isToolsOptionPage is true,the ProvideOptionPageAttribute must also be applied to the VSPackage.

Custom Settings Points are created within a registry entry containing the canonical name of the form <CategoryName>_<ObjectName>.

The registry key is found under HKLM\Software\Microsoft\VisualStudio\<Version>\UserSettings where <Version> is the version of Visual Studio, for example 8.0.

The registry entry under <CategoryName>_<ObjectName> is of the form:

<CategoryName>_<ObjectName>

<CategoryName>_<ObjectName>\@=#<ObjectNameResourceID>

<CategoryName>_<ObjectName>\Package=<Package>

<CategoryName>_<ObjectName>\Category=<ObjectTypeGuid>

<CategoryName>_<ObjectName>\AlternateParent =<CategoryName>

Note

The last entry above (<CategoryName>_<ObjectName>\AlternateParent) is created only if isToolsOptionPage is true.

Examples

The example below shows the registration of two classes providing Visual Studio settings, one of which (DesignerOptionsPage) provides Tools Options page support. The Package and category GUIDs are obtained by the attribute by reflection.

The Custom Settings Point for the page named "DesignerOptionsPage" are:

MyDesigner_OptionPage

MyDesigner_OptionPage\@=#1003

MyDesigner_OptionPage\Package={"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"}

MyDesigner_OptionPage\Category={"YYYYYYYY-YYYY-YYYY-YYYY-YYYYYYYYYYYY"}

MyDesigner_OptionPage\AlternateParent =MyDesigner

Note

The last entry above, (UserSettings\MyDesigner_OptionPage\AlternateParent), is present because isToolsOptionPage is true.

The Custom Settings Point for the page named "PersistCurrentDesign" are:

MyDesigner_CurrentDesign

MyDesigner_CurrentDesign\@=#1005>

MyDesigner_CurrentDesign\Package={"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"}

MyDesigner_CurrentDesign\Category={"ZZZZZZZZ-ZZZZ-ZZZZ-ZZZZ-ZZZZZZZZZZZZ"}>

Note

There is no (MyDesigner_ObjectName>\AlternateParent) because isToolsOptionPage is false.

The sample code below illustrates how DesignerOptionsPage is registered using the ProvideProfileAttribute.

using Microsoft.VisualStudio.Shell;
namespace Example
{
[DefaultRegistryRoot("Software\\Microsoft\\VisualStudio\\8.0")] 
[ProvideOptionPage(typeof(DesignerOptionsPage), "MyDesigner", "OptionPage", 1000, 1001, true)] 
[ProvideProfileAttribute(typeof(DesignerOptionsPage), "MyDesigner", "OptionPage", 1002, 1003, true)]
[ProvideProfileAttribute(typeof(PersistCurrentDesign), "MyDesigner","CurrentDesign", 1004, 1005, false)]
 [Guid("XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX")]
public class MyPackage : Package
{
//Implementation here
}

[Guid("YYYYYYYY-YYYY-YYYY-YYYY-YYYYYYYYYYYY")]
internal class DesignerOptionsPage: DialogPage {
//Implementation here
}

[Guid("ZZZZZZZZ-ZZZZ-ZZZZ-ZZZZ-ZZZZZZZZZZZZ")]
internal class PersisteDesignerState: IProfileManager {
//Implementation here

.NET Framework Security

See Also

Reference

ProvideProfileAttribute Class

Microsoft.VisualStudio.Shell Namespace

ProvideProfileAttribute

Other Resources

User Settings and Options

Persisting Settings