I'm implementing a Microsoft.VisualStudio.Shell.Package
that adds a command in the context menu, when a Solution Explorer item is clicked.
The code that adds the command looks something like this:
_oleMenuCommandService = GetService(typeof (IMenuCommandService)) as OleMenuCommandService;
if (_oleMenuCommandService != null)
{
var menuCommandId = new CommandID(GuidList.guidErsx_Net_VsixCmdSet, (int) PkgCmdIDList.sortResx);
var menuItem = new OleMenuCommand(MenuItemClick, StatusChanged, BeforeContextMenuOpens, menuCommandId);
_oleMenuCommandService.AddCommand(menuItem);
}
The package is defined like this:
[PackageRegistration(UseManagedResourcesOnly = true)]
[InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)]
[ProvideMenuResource("Menus.ctmenu", 1)]
[Guid(GuidList.guidErsx_Net_VsixPkgString)]
[ProvideAutoLoad(VSConstants.UICONTEXT.SolutionExistsAndFullyLoaded_string)]
The command shows when any Solution Explorer item is right clicked, except any of the following:
- The item is under a website project
- The item is a csproj file
- The item is a folder
In these cases the events defined above are not fired at all.
How can I cover these cases as well? Do I need to register something somewhere?