Export (0) Print
Expand All

IProfileManager Interface

Interface implemented by classes supporting VSPackages by persisting their state information through the Visual Studio settings mechanism.

 

Namespace: Microsoft.VisualStudio.Shell
Assembly: Microsoft.VisualStudio.Shell (in microsoft.visualstudio.shell.dll)

[CLSCompliantAttribute(false)] 
public interface IProfileManager
/** @attribute CLSCompliantAttribute(false) */ 
public interface IProfileManager
CLSCompliantAttribute(false) 
public interface IProfileManager

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

Providing Visual Studio settings support for a VSPackage should be done by implementing IProfileManager on a class independent of the class implementing the VSPackage itself.

This is because a class providing IProfileManager support will be instantiated when a user chooses the Import/Export Settings command on the Tools menu to save or retrieve Visual Studio state.

The Component base class does this for the derived class and it is the easiest way to fulfill the requirement.

The object implementing IProfileManager is registered as supporting a given VSPackage by applying a ProvideProfileAttribute to the package implementation. For more information, see Persisting Settings and ProvideProfileAttribute.

Implement SaveSettingsToXml and LoadSettingsFromXml to use the IVsSettingsWriter and IVsSettingsReader interfaces to save VSPackage state to on-disk Visual Studio settings storage.

Implement SaveSettingsToStorage and LoadSettingsFromStorage to save information to local storage (typically the registry), and that VSPackage.

The Visual Studio environment first calls LoadSettingsFromStorage and then SaveSettingsToXml for settings export operations.

LoadSettingsFromXml and then SaveSettingsToStorage are called for settings import operations.

For more information, see How to: Import Settings by Using the Managed Package Framework and How to: Export Settings by Using the Managed Package Framework.

The Visual Studio also calls LoadSettingsFromStorage when it starts up a VSPackage to properly initialize its state.

Notes to Implementers Implement this interface on a class when a VSPackage needs to save or retrieve settings from disk via the Visual Studio settings mechanism, as well as keeping its state synchronized with local storage (such as the registry). Classed implementing IProfileManager, must also implement IComponent.

Community Additions

ADD
Show:
© 2015 Microsoft