Package.ParseToolboxResource Method (TextReader, ResourceManager)
Parses an embedded text resource of appropriate format for information about which items should be added to the Toolbox.
Assembly: Microsoft.VisualStudio.Shell.10.0 (in Microsoft.VisualStudio.Shell.10.0.dll)
'Declaration Protected Sub ParseToolboxResource ( _ resourceData As TextReader, _ localizedCategories As ResourceManager _ )
protected void ParseToolboxResource( TextReader resourceData, ResourceManager localizedCategories )
protected: void ParseToolboxResource( TextReader^ resourceData, ResourceManager^ localizedCategories )
member ParseToolboxResource : resourceData:TextReader * localizedCategories:ResourceManager -> unit
protected function ParseToolboxResource( resourceData : TextReader, localizedCategories : ResourceManager )
A text reader that provides toolbox item data in the format described in Remarks.
A resource manager that provides localized lookup names for the categories provided in the resource data. This parameter can be null, in which case the category names are directly used.
The text resource that a VSPackage parses using ParseToolboxResource must be embedded in an assembly and name space accessible to the VSPackage.
Text resources should be added to an assembly by right-clicking on the assembly's project, selection Add and the New Item. From the New Item menu, then select Text File. Once the text file has been added to the project, set its Build Action property to Embedded Resource.
This method can be used to add items to the toolbox automatically. The resource data is passed in through the resourceData parameter and consists of a text file with the following format:
; Comment [CategoryName] <class name>, <assembly name>
The category name can be localized through the localizedCategories resource manager that is passed into this method. The localizedCategories parameter may be null, in which case the category names are not localized.
The assembly name may either be a fully qualified name or a partial name. If a partial name is passed, the most recently accessed assembly with that partial name is loaded.
When processing assembly names, ParseToolboxResource, searches only directories specified in keys in the registry entry HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\<version>\AssemblyFolders, where <version> is the version number of the release of Visual Studio (for example, 8.0)
The root path of HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\<Version> can be overridden with an alternate root when the Visual Studio shell is initialized, or use of DefaultRegistryRootAttribute. For more information see, Command-Line Switches (Visual Studio SDK) and DefaultRegistryRootAttribute.
The format of sub-keys under HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\<version>\AssemblyFolders is
A string containing a fully qualified path to a directory which should contain assemblies used by Visual Studio.
The key's name, <FriendlyName>, may be any value so long as it is unique. The key's data contains the full path to a directory containing assemblies to be searched by ParseToolboxResource
Any VSPackage needing to use ParseToolboxResource must register itself with the Visual Studio environment as providing Toolbox items.
The attribute ProvideToolboxItemsAttribute must be applied to the VSPackage's implementation of Package. Depending on the implementation of the VSPackage ProvideToolboxFormatAttribute and ProvideToolboxItemConfigurationAttribute may also be required.
For more information on writing a Toolbox item provider, see Advanced Toolbox Control Development.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.