ProvideProfileAttribute ProvideProfileAttribute ProvideProfileAttribute ProvideProfileAttribute ProvideProfileAttribute Class


Apply this attribute to independent objects used to implement a VSPackage's Visual Studio settings support.

public ref class ProvideProfileAttribute sealed : Microsoft::VisualStudio::Shell::RegistrationAttribute
public ref class ProvideProfileAttribute sealed : Microsoft::VisualStudio::Shell::RegistrationAttribute
[System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=true, Inherited=true)]
public sealed class ProvideProfileAttribute : Microsoft.VisualStudio.Shell.RegistrationAttribute
type ProvideProfileAttribute = class
    inherit RegistrationAttribute
Public NotInheritable Class ProvideProfileAttribute
Inherits RegistrationAttribute


In the example below, two instances of ProvideProfileAttribute are applied to a VSPackage implementation to define the two classes as providing Visual Studio settings support for the VSPackage implemented by the class MyPackage.

  1. Because the implementation of the page named "DesignerOptionsPage" is derived from DialogPage, it can support Visual Studio settings and Tools Options pages, and is registered as providing both:

    • An implementation of a Tools Options page, which is registered through the instance ProvideOptionPageAttribute. For more information on supporting Tools Options pages, see ProvideOptionPageAttribute.

    • An implementation that supports persisting the state of Tools Options pages, which is indicated by the final argument to the ProvideProfileAttribute constructor.

  2. The class named "PersistedDesignerState" is registered as providing just Visual Studio settings support, saving and retrieving remaining state information of the VSPackage named "MyPackage" by implementing IProfileManager.

using Microsoft.VisualStudio.Shell;  
namespace Example  
[ProvideOptionPage(typeof(DesignerOptionsPage), "MyDesigner", "OptionPage", 1000, 1001, true)]   
[ProvideProfileAttribute(typeof(DesignerOptionsPage), "MyDesigner", "OptionPage", 1002, 1003, true)]  
[ProvideProfileAttribute(typeof(PersistCurrentDesign), "MyDesigner","CurrentDesign", 1004, 1005, false)]  
public class MyPackage : Package  
//Implementation here  

internal class DesignerOptionsPage: DialogPage {  
//Implementation here  

internal class PersistCurrentDesign: IProfileManager {  
//Implementation here  


Notes for Callers

Apply the ProvideProfileAttribute attribute to classes implementing a VSPackage when there is a class that implements Visual Studio settings functionality for the VSPackage, allowing it to save and retrieve VSPackage state information.


Classes implementing IProfileManager, must also implement IComponent, which can be done by deriving the class from Component.

Attribute Context

Applies to VSPackages using the Visual Studio settings mechanism through classes that implement the IProfileManager or DialogPage interfaces.
Repeatable Yes
Required attributes DefaultRegistryRootAttribute, Note If the class implementing Visual Studio settings also provides a Tools Options page, ProvideOptionPageAttribute is also required.
Invalid attributes None

Notes for Implementers

This attribute is used only for registration purposes and does not affect runtime behavior.

ProvideProfileAttribute registers a class implementing IProfileManager or DialogPage as providing support for persisting part or all of the VSPackage's state through the Visual Studio settings mechanism. The state information persisted by the implementing class is referred to as a Visual Studio settings category, and its defining entry in the registry is referred to as a Custom Settings Point.

When a user selects the Import/Export Settings command on the Tools menu to save Visual Studio settings, the classes registered by ProvideProfileAttribute are instantiated by the IDE and used to save the settings.

Because of this:

  • Visual Studio settings support should be implemented on its own object and not on the VSPackage itself.

  • A class implementing Visual Studio settings may support only one Visual Studio settings category as defined in Custom Settings Point.

    However, a single VSPackage may support several Visual Studio settings categories as defined multiple Custom Settings Points as long as:

  • Each Visual Studio settings category is implemented in a separate class..

  • Each class implementing Visual Studio settings is registered as supporting the VSPackage by its own instance of ProvideProfileAttribute.


    This differs from the COM-based implementations where a class implementing Visual Studio settings may support multiple Custom Settings Points.

    An instance of ProvideProfileAttribute:

  • Uniquely identifies a Custom Settings Point's Visual Studio settings category with the GUID obtained from the Type of the class implementing Visual Studio settings.

  • Sets a Visual Studio settings category's name, both its canonical, nonlocalized name used in registry entries and its localized name resources.

  • Indicates if the Visual Studio settings supporting class's implementation of ProvideProfileAttribute supports a Tools Options page (for more information on supporting Tools Options page, see Options Pages).

    For more information on creating and applying instances of ProvideProfileAttribute, see the example below and ProvideProfileAttribute.


ProvideProfileAttribute(Type, String, String, Int16, Int16, Boolean) ProvideProfileAttribute(Type, String, String, Int16, Int16, Boolean) ProvideProfileAttribute(Type, String, String, Int16, Int16, Boolean) ProvideProfileAttribute(Type, String, String, Int16, Int16, Boolean) ProvideProfileAttribute(Type, String, String, Int16, Int16, Boolean)

Initializes a new instance of ProvideProfileAttribute.


AlternateParent AlternateParent AlternateParent AlternateParent AlternateParent

Gets or sets the name of a different category in the profile.

CategoryName CategoryName CategoryName CategoryName CategoryName

Gets the canonical nonlocalized name of the Visual Studio settings category.

CategoryResourceID CategoryResourceID CategoryResourceID CategoryResourceID CategoryResourceID

Gets the name resource ID for a Visual Studio settings category.

DescriptionResourceID DescriptionResourceID DescriptionResourceID DescriptionResourceID DescriptionResourceID

Gets the localized resource ID of the description of this page of the profile.

GroupName GroupName GroupName GroupName GroupName

Gets the nonlocalized name of this group.

GroupResourceID GroupResourceID GroupResourceID GroupResourceID GroupResourceID

Gets or sets the localized resource ID of the group to which this page belongs.

IsToolsOptionPage IsToolsOptionPage IsToolsOptionPage IsToolsOptionPage IsToolsOptionPage

Gets whether this is also a Tools Options page.

MigrationType MigrationType MigrationType MigrationType MigrationType

Sets the migration action to take for this category.

ObjectName ObjectName ObjectName ObjectName ObjectName

Gets the canonical nonlocalized name of this page in the profile.

ObjectNameResourceID ObjectNameResourceID ObjectNameResourceID ObjectNameResourceID ObjectNameResourceID

Gets the localized resource ID of the name of this page in the profile.

ObjectType ObjectType ObjectType ObjectType ObjectType

Gets the type of the page.

ResourcePackageGuid ResourcePackageGuid ResourcePackageGuid ResourcePackageGuid ResourcePackageGuid

Gets or sets the GUID of a package providing the resource strings.

TypeId TypeId TypeId TypeId TypeId

Gets the current instance of this attribute.

(Inherited from RegistrationAttribute)


GetPackageRegKeyPath(Guid) GetPackageRegKeyPath(Guid) GetPackageRegKeyPath(Guid) GetPackageRegKeyPath(Guid) GetPackageRegKeyPath(Guid)

Gets the registry path (relative to the registry root of the application) of the VSPackage.

(Inherited from RegistrationAttribute)
Register(RegistrationAttribute+RegistrationContext) Register(RegistrationAttribute+RegistrationContext) Register(RegistrationAttribute+RegistrationContext) Register(RegistrationAttribute+RegistrationContext) Register(RegistrationAttribute+RegistrationContext)

Registers this attribute.

Unregister(RegistrationAttribute+RegistrationContext) Unregister(RegistrationAttribute+RegistrationContext) Unregister(RegistrationAttribute+RegistrationContext) Unregister(RegistrationAttribute+RegistrationContext) Unregister(RegistrationAttribute+RegistrationContext)

Removes the key from the registry.

Applies to