I'm working on an extension and had to delete a custom command then re add it. Now when I try to run the extension I get an error saying
There is already a command handler for the menu command.
Has anyone come across this before? Any ideas how to fix? I've tried creating a new GUID and changing the commandId but no luck.
Error Output: An exception of type 'System.ArgumentException' occurred in System.Design.dll but was not handled in user code
Additional information: There is already a command handler for the menu command '4fd442a6-1a00-47ee-b98d-f11b0faafbe2 : 256'.
From the vsct file:
<GuidSymbol name="guidVSProximityMenuPackageCmdSet3" value="{4FD442A6-1A00-47EE-B98D-F11B0FAAFBE2}">
<IDSymbol name="ProximityProjectExplorerGroup" value="4128" />
<IDSymbol value="256" name="cmdidGetNugetVersionCommand" />
</GuidSymbol>
From the command.cs file:
/// <summary>
/// Command ID.
/// </summary>
public const int CommandId = 256;
/// <summary>
/// Command menu group (command set GUID).
/// </summary>
public static readonly Guid CommandSet = new Guid("4FD442A6-1A00-47EE-B98D-F11B0FAAFBE2");
The exception is thrown from this method (located in the command.cs file)
/// <summary>
/// Initializes a new instance of the <see cref="GetNugetVersionCommand"/> class.
/// Adds our command handlers for menu (commands must exist in the command table file)
/// </summary>
/// <param name="package">Owner package, not null.</param>
private GetNugetVersionCommand(Package package)
{
if (package == null)
{
throw new ArgumentNullException("package");
}
this.package = package;
OleMenuCommandService commandService = this.ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
if (commandService != null)
{
var menuCommandID = new CommandID(CommandSet, CommandId);
var menuItem = new MenuCommand(this.MenuItemCallback, menuCommandID);
commandService.AddCommand(menuItem);
}
}
On the commandService.AddCommand(menuItem); line when I try to call a different command from the menu in Visual Studio.
Thanks again for any help!