.NET Forum / Visual Studio.NET / Extensibility / July 2006
VS 2005 Add-in and Keyboard mapping?
|
|
Thread rating:  |
BartMan - 06 Jul 2006 18:48 GMT Greetings,
I have written a custom add-in in c# for 2005 and I can't seem to get the add-in to appear under the "Tools\Customize\Addins\" section.
I have converted my default addin code to act as a toolbar as per an article on msdn. (I think it was about an office tool bar, but I used Microsoft.VisualStudio.CommandBars in place of the office bars).
Everything works fine, but I can't seem to map keyboard presses to my addin. I can't seem to find the bar anywhere. Any ideas?
Thanks in advance for any help!
"Gary Chang[MSFT]" - 07 Jul 2006 07:52 GMT Hi,
Thank you posting!
Based on my understanding, the problem is you develop a custom add-in commandbar based on a MSDN article, but you cannot find it in the VS2005 IDE. Please correct me if I misunderstood anything.
In order to isolate this problem, we need to confirm whether your add-in has been loaded/registered in the VS2005 or not. Could you find your custom commandbar add-in's entry in the Add-ins Manager (Tools | Add-ins Manager)?
If your commandbar add-in has already been loaded/registered in the VS2005, but the command information is lost and your commands disappear from the menu or toolbar, I suggest you can try the following procedure demonstrates how to restore the commands:
1.Exit all instances of Visual Studio. 2.Make sure the value of the <CommandPreload> tag in the .Addin XML registration file is set to 1. 3.Restart Visual Studio.
If the above steps don't work either, then we need more detailed information about your add-in program, on which MSDN article your add-in program is based? How do you modify that article's sample?
These information and tests will help us get closer to resolving your issue, so I appreciate your time in performing them. Let me know the results at your earliest convenience. If you have any questions or concerns, please let me know. I am standing by to help you
Thanks!
Best regards,
Gary Chang Microsoft Online Community Support ================================================== When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights.
BartMan - 07 Jul 2006 15:10 GMT > Based on my understanding, the problem is you develop a custom add-in > commandbar based on a MSDN article, but you cannot find it in the VS2005 > IDE. Please correct me if I misunderstood anything. Hello Gary thanks for the post! Yes that is correct.
> In order to isolate this problem, we need to confirm whether your add-in > has been loaded/registered in the VS2005 or not. Could you find your custom > commandbar add-in's entry in the Add-ins Manager (Tools | Add-ins Manager)? Yes, it does show up in the Add-ins manager.
> If your commandbar add-in has already been loaded/registered in the VS2005, > but the command information is lost and your commands disappear from the [quoted text clipped - 5 lines] > registration file is set to 1. > 3.Restart Visual Studio. The tag has already been set, and seems to be registered correctly.
> If the above steps don't work either, then we need more detailed > information about your add-in program, on which MSDN article your add-in > program is based? How do you modify that article's sample? I don't remember what the exact article, but what I did was create an addin using the EnvDTE.DTE technique simliar to the article link below (this link was shared by Carlos who posted below, but is pretty similar to how I created my tool bar). http://www.mztools.com/articles/2005/MZ003.htm
But the key difference is that I put my creation code for the tool bar and buttons in the "OnStartupComplete()" event method, because it seemed to always go into the connect method several times so I moved it. I suspect that this maybe my cause of the problem, but I am not sure.
"Gary Chang[MSFT]" - 11 Jul 2006 06:21 GMT Hi,
>But the key difference is that I put my creation code >for the tool bar and buttons in the "OnStartupComplete()" >event method, because it seemed to always go into the >connect method several times so I moved it. I suspect >that this maybe my cause of the problem, but I am not sure. I have tested that sample code and moved the main function routine of OnConnect to the OnStartupComplete procedure, it works fine on my side. The My Menu item and MyCommand commandbar button could be loaded as expected while starting the VS2005 IDE.
In this regard, I thnk there may be some problems in other modification of your add-in program, I suggest you can search the problem in that direction.
Thanks for your understanding!
Best regards,
Gary Chang Microsoft Online Community Support ================================================== When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights.
"Gary Chang[MSFT]" - 13 Jul 2006 11:16 GMT Hi,
Just wanted to check and see how things are going, have you tried MVP Carlos' suggestion?
If you still have problems on this issue, please let me know. It's my pleasure to be of assistance.
Thanks!
Best regards,
Gary Chang Microsoft Online Community Support ================================================== When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights.
BartMan - 14 Jul 2006 14:14 GMT Yes his post was very useful, I figured what I needed from his site. Thanks!
> Hi, > [quoted text clipped - 15 lines] > ================================================== > This posting is provided "AS IS" with no warranties, and confers no rights. "Gary Chang[MSFT]" - 17 Jul 2006 07:09 GMT Hi Mark,
Thanks for the update, have a nice day!
Best regards,
Gary Chang Microsoft Online Community Support ================================================== When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights.
Charles Zhang - 17 Jul 2006 08:44 GMT Actually, I would like to know the way to fix that bug.
Thanks
Gary Chang[MSFT] wrote:
> Hi Mark, > [quoted text clipped - 9 lines] > ================================================== > This posting is provided "AS IS" with no warranties, and confers no rights. Charles Zhang - 17 Jul 2006 08:46 GMT Thanks, I would like to know the way to fix the bug. I am not quite sure "VS 2005 Add-in and Keyboard mapping" means.
Thanks
Gary Chang[MSFT] wrote:
> Hi Mark, > [quoted text clipped - 9 lines] > ================================================== > This posting is provided "AS IS" with no warranties, and confers no rights. "Gary Chang[MSFT]" - 17 Jul 2006 09:49 GMT Hi Charles,
>Thanks, I would like to know the way to fix the bug. I am not very clear what the bug you mentioned in this issue. The OP already found out the root cause of this problem, he just forgot to add the commands to the _applicationObject.Commands collection while adding the items to the toolbar.
Thanks!
Best regards,
Gary Chang Microsoft Online Community Support ================================================== Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. Please note that each follow up response may take approximately 2 business days as the support professional working with you may need further investigation to reach the most efficient resolution. The offering is not appropriate for situations that require urgent, real-time or phone-based interactions or complex project analysis and dump analysis issues. Issues of this nature are best handled working with a dedicated Microsoft Support Engineer by contacting Microsoft Customer Support Services (CSS) at http://msdn.microsoft.com/subscriptions/support/default.aspx. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>Date: Mon, 17 Jul 2006 00:46:26 -0700 >From: Charles Zhang <CharlesZhang@newsgroups.nospam> >User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) >MIME-Version: 1.0 >Subject: Re: VS 2005 Add-in and Keyboard mapping? >References: <FBD7B923-2643-406D-B14C-32F6E7383762@microsoft.com> <f35l6HZoGHA.6028@TK2MSFTNGXA01.phx.gbl> <5F0396A9-9B92-4CE6-9184-4165FAE873F1@microsoft.com> <oNi8uVmpGHA.4612@TK2MSFTNGXA01.phx.gbl> <B9A3F2E2-63F2-4103-BE2A-EE31EFBB023D@microsoft.com> <gDNPieWqGHA.1572@TK2MSFTNGXA01.phx.gbl>
>In-Reply-To: <gDNPieWqGHA.1572@TK2MSFTNGXA01.phx.gbl> >Content-Type: text/plain; charset=ISO-8859-1; format=flowed [quoted text clipped - 26 lines] >> ================================================== >> This posting is provided "AS IS" with no warranties, and confers no rights. Carlos J. Quintero [VB MVP] - 07 Jul 2006 08:37 GMT Are you using EnvDTE commands to create the buttons? What you see in that tab are commands, See:
HOWTO: Adding buttons, commandbars and toolbars to Visual Studio .NET from an add-in.
HOWTO: Removing commands and UI elements during Visual Studio .NET add-in uninstallation.
at:
Resources about Visual Studio .NET 2002/2003 and Visual Studio 2005 extensibility http://www.mztools.com/resources_vsnet_addins.htm
 Signature Best regards,
Carlos J. Quintero
MZ-Tools: Productivity add-ins for Visual Studio You can code, design and document much faster: http://www.mztools.com
> Greetings, > [quoted text clipped - 11 lines] > > Thanks in advance for any help! BartMan - 07 Jul 2006 15:02 GMT > Are you using EnvDTE commands to create the buttons? What you see in that > tab are commands, See: Hello Carlos, thanks for the reply! Yes I am using EnvDTE commands to create the buttons.
I did this before by performing the creation in an ATL control last time, and I was able to map commands to it. Now that I am doing pretty much the same code in C#, but the only difference is that the addin isn't showing up in for the short cuts.
I am currently creating my tool bar in the OnStartupComplete() function, so is why the commands don't get registered?
Carlos J. Quintero [VB MVP] - 11 Jul 2006 09:11 GMT > I am currently creating my tool bar in the OnStartupComplete() function, > so > is why the commands don't get registered? That is not correct since that event only fires if the add-in is loaded at the same time that VS. It won't fire if the user loads the add-in using the add-in manager after VS is loaded. See again the code of my article
HOWTO: Adding buttons, commandbars and toolbars to Visual Studio .NET from an add-in http://www.mztools.com/articles/2005/MZ003.htm
and stick to it. Ensure that it works as expected. Then, if you want to deviate, tell us why. BTW, I updated the article yesterday with more info.
 Signature Best regards,
Carlos J. Quintero
MZ-Tools: Productivity add-ins for Visual Studio You can code, design and document much faster: http://www.mztools.com
BartMan - 14 Jul 2006 14:18 GMT > That is not correct since that event only fires if the add-in is loaded at > the same time that VS. It won't fire if the user loads the add-in using the > add-in manager after VS is loaded. See again the code of my article I figured it out my problem I was adding my items to the toolbar, and the buttons were showing up fine, but I forgot to add the commands to the _applicationObject.Commands collection. Once I did that they showed up fine.
Thanks for the great web site!
Free MagazinesGet these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...
|
|
|