Condividi tramite


Loading VSPackages

VSPackages are loaded into memory only when their accompanying functionality is required to complete a process. This feature is called delayed loading. Visual Studio uses delayed loading whenever possible to improve performance.

A VSPackage is loaded, for example, when the following conditions are true:

  • Visual Studio requires a project factory that a VSPackage implements.

  • Visual Studio requests a service or editor that a VSPackage implements.

Nota

Visual Studio can determine certain VSPackage information, such as the commands that a VSPackage offers, without loading the VSPackage.

Autoloading a VSPackage

VSPackages can be set to autoload when a particular CMDUICONTEXT GUID is turned on. A debugger VSPackage, for example, might register itself to be autoloaded with the following CmdUIGuids:

For more information, see How to: Autoload a VSPackage

Forcing a VSPackage to Load

Under some circumstances, a VSPackage may have to force another VSPackage to be loaded. . For example, a lightweight VSPackage might load a larger VSPackage in a context that is not available as a CMDUIContext.

You can use the LoadPackage method to force a VSPackage to load. For more information, see How to: Force a VSPackage to Load.

See Also

Concepts

Extension Analyzer

Other Resources

VSPackages