Another very confusing thing when starting with packages and you have a background of creating add-ins is how to name a command.
With add-ins, the (full) name of a command was composed by two parts:
- A prefix that was the ProgId (VS.NET 2002/2003) or namespace (VS 2005 and higher) of the Connect class. See: HOWTO: Create command names without ‘.Connect’ in Visual Studio add-ins
- The actual (short) name of the command, which was explicitly set when you create the command with the Commands2.AddNamedCommand2 method.
And one interesting consequence was that all the commands of your add-in used the same prefix. With packages this is not true. The prefix of a command created by a package follows some complicated rules that depend on the menu / toolbar / context menu where the command is mainly placed (because, you know, a command is not a UI item and you can create several UI items in different locations tied to the same command).
And even the (short) name of the command can vary depending on the values of <CommandName>, <LocCanonicalName> and, go figure, can even be inferred from the caption of the command (<ButtonText>) removing special characters, etc.
I have written this article to try to explain all rules: