title: Visual Studio Extension - There is already a command handler for the menu command
body: <p>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 </p>
  
  <blockquote>
    <p>There is already a command handler for the menu command. </p>
  </blockquote>
  
  <p>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.</p>
  
  <blockquote>
    <p>Error Output: An exception of type 'System.ArgumentException' occurred
    in System.Design.dll but was not handled in user code</p>
    
    <p>Additional information: There is already a command handler for the
    menu command '4fd442a6-1a00-47ee-b98d-f11b0faafbe2 : 256'.</p>
  </blockquote>
  
  <p>From the vsct file: </p>
  
  <pre><code> &lt;GuidSymbol  name="guidVSProximityMenuPackageCmdSet3" value="{4FD442A6-1A00-47EE-B98D-F11B0FAAFBE2}"&gt;
  
    &lt;IDSymbol name="ProximityProjectExplorerGroup" value="4128" /&gt;
    &lt;IDSymbol value="256" name="cmdidGetNugetVersionCommand" /&gt;
  
   &lt;/GuidSymbol&gt;
  </code></pre>
  
  <p>From the command.cs file: </p>
  
  <pre><code>/// &lt;summary&gt;
      /// Command ID.
      /// &lt;/summary&gt;
      public const int CommandId = 256;
  
      /// &lt;summary&gt;
      /// Command menu group (command set GUID).
      /// &lt;/summary&gt;
      public static readonly Guid CommandSet = new Guid("4FD442A6-1A00-47EE-B98D-F11B0FAAFBE2");
  </code></pre>
  
  <p>The exception is thrown from this method (located in the command.cs file)</p>
  
  <pre><code>/// &lt;summary&gt;
      /// Initializes a new instance of the &lt;see cref="GetNugetVersionCommand"/&gt; class.
      /// Adds our command handlers for menu (commands must exist in the command table file)
      /// &lt;/summary&gt;
      /// &lt;param name="package"&gt;Owner package, not null.&lt;/param&gt;
      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);
          }
      }
  </code></pre>
  
  <p>On the commandService.AddCommand(menuItem); line when I try to call a different command from the menu in Visual Studio. </p>
  
  <p>Thanks again for any help!</p>