ProvideMenuResourceAttribute Class
Provides registration information about menu resources used in a VSPackage. This class cannot be inherited.
Assembly: Microsoft.VisualStudio.Shell.14.0 (in Microsoft.VisualStudio.Shell.14.0.dll)
System.Attribute
Microsoft.VisualStudio.Shell.RegistrationAttribute
Microsoft.VisualStudio.Shell.ProvideMenuResourceAttribute
| Name | Description | |
|---|---|---|
![]() | ProvideMenuResourceAttribute(Int16, Int32) | This constructor creates a new ProvideMenuResourceAttribute object with the given resource ID and version number. |
![]() | ProvideMenuResourceAttribute(String, Int32) | Initializes a new instance of ProvideMenuResourceAttribute with the specified resource ID and version. |
| Name | Description | |
|---|---|---|
![]() | IconMappingFilename | Gets the path to a CSV file which maps the icon identifiers defined in the menu resource to image monikers. The path is either a relative path implicitly rooted at $PackageFolder$, or an absolute path explicitly rooted at a directory defined by an environment variable (e.g. "%UserProfile%\dir1\dir2\MyMappingFile.csv"). The format of the CSV file is: Icon GUID, Icon ID, Moniker GUID, Moniker ID For example: b714fcf7-855e-4e4c-802a-1fd87144ccad,1,fda30684-682d-421c-8be4-650a2967058e,100 {b714fcf7-855e-4e4c-802a-1fd87144ccad},2,{fda30684-682d-421c-8be4-650a2967058e},200 |
![]() | ResourceID | The ResourceID property returns the value of the resource ID set in the constructor. |
![]() | TypeId | Gets the current instance of this attribute.(Inherited from RegistrationAttribute.) |
![]() | Version | Returns the version number of the menu resource. |
| Name | Description | |
|---|---|---|
![]() | Equals(Object) | (Inherited from Attribute.) |
![]() | GetHashCode() | (Inherited from Attribute.) |
![]() | GetType() | (Inherited from Object.) |
![]() | IsDefaultAttribute() | (Inherited from Attribute.) |
![]() | Match(Object) | (Inherited from Attribute.) |
![]() | Register(RegistrationAttribute.RegistrationContext) | Provides registration information about a VSPackage when called by an external registration tool such as regpkg.exe. For more information, see Registering VSPackages.(Overrides RegistrationAttribute.Register(RegistrationAttribute.RegistrationContext).) |
![]() | ToString() | (Inherited from Object.) |
![]() | Unregister(RegistrationAttribute.RegistrationContext) | Removes registration information about a VSPackage when called by an external registration tool such as regpkg.exe. For more information, see Registering VSPackages.(Overrides RegistrationAttribute.Unregister(RegistrationAttribute.RegistrationContext).) |
| Name | Description | |
|---|---|---|
![]() ![]() | _Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) | (Inherited from Attribute.) |
![]() ![]() | _Attribute.GetTypeInfo(UInt32, UInt32, IntPtr) | (Inherited from Attribute.) |
![]() ![]() | _Attribute.GetTypeInfoCount(UInt32) | (Inherited from Attribute.) |
![]() ![]() | _Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) | (Inherited from Attribute.) |
Apply the ProvideMenuResourceAttribute to a Microsoft.VisualStudio.Package-derived class or class that implements IVsPackage if the class contains one or more menu resources. Register the resources with regpkg.exe or a similar registration tool. For more information, see Registering VSPackages.
The ProvideMenuResourceAttribute class defines the resource ID and version number of a menu resource, allowing a registration tool such as regpkg.exe to register the menu resource with Visual Studio. When Visual Studio encounters a VSPackage with a registered menu resource, it retrieves the resource information from the VSPackage or the package's managed or satellite DLL and merges the menu into the Visual Studio menu system. To use ProvideMenuResourceAttribute, place it on a Package-derived class or class that implements IVsPackage.
For the menu resource to merge correctly, the resource DLL must follow the satellite DLL conventions. It must be named <assemblyfile>UI.dll, and placed into an appropriate, localized subdirectory. For additional information on menus and menu resources, see How VSPackages Add User Interface Elements and Commands, Menus, and Toolbars.
This attribute class is only used to provide data for external registration tools. It does not have any effect on the run-time behavior of the VSPackage.
Note |
|---|
C# automatically appends the word "Attribute" to the name of any attribute class. In C# code, refer to this attribute as ProvideMenuResource. |
The following registry entries are created by ProvideMenuResourceAttribute:
<VSROOT>\Menus\
<VSROOT>\Menus\{PackageGuid}=", ResourceID, Version"
You can find implementations of the ProvideMenuResourceAttribute class in the managed samples. The standard location for this and all other attributes used for automatic registration is adjacent to the implementation of the Package class in VsPkg.cs, VsPkg.vb, or VsPkg.cpp, depending on the language used in the sample.
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.




