473,721 Members | 1,769 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Visual Studio 2005 add-in : my button doesn't appear in Tools menu

Hi,
I build an add-in for Visual Studio 2005.
I use the wizzard, I fixed the bug with envdte reference and build my
project immediately after the wizzard.
All seems to work, the add-in is shown in add-in Manager window, but no
button appears in Tools window.

Here is my code:

namespace MyAddinTest
{
using System;
using Microsoft.Visua lStudio.Command Bars;
using Extensibility;
using EnvDTE;
using EnvDTE80;

/// <summary>The object for implementing an Add-in.</summary>
/// <seealso class='IDTExten sibility2' />
public class Connect : Object, IDTExtensibilit y2, IDTCommandTarge t
{
/// <summary>Implem ents the constructor for the Add-in object. Place
your initialization code within this method.</summary>
public Connect()
{
}

/// <summary>Implem ents the OnConnection method of the
IDTExtensibilit y2 interface. Receives notification that the Add-in is
being loaded.</summary>
/// <param term='applicati on'>Root object of the host
application.</param>
/// <param term='connectMo de'>Describes how the Add-in is being
loaded.</param>
/// <param term='addInInst '>Object representing this Add-in.</param>
/// <seealso class='IDTExten sibility2' />
public void OnConnection(ob ject application, ext_ConnectMode
connectMode, object addInInst, ref Array custom)
{
applicationObje ct = (DTE2)applicati on;
addInInstance = (AddIn)addInIns t;
if(connectMode == ext_ConnectMode .ext_cm_UISetup )
{
object []contextGUIDS = new object[] { };
Commands2 commands = (Commands2)appl icationObject.C ommands;

try
{
CommandBar menuBarCommandB ar;
CommandBarContr ol toolsControl;
CommandBarPopup toolsPopup;
CommandBarContr ol commandBarContr ol;

//Add a command to the Commands collection:
Command command = commands.AddNam edCommand2(addI nInstance,
"MyAddinTes t", "MyAddinTes t", "Executes the command for MyAddinTest",
true, 59, ref contextGUIDS,
(int)vsCommandS tatus.vsCommand StatusSupported +(int)vsCommand Status.vsCom
mandStatusEnabl ed, (int)vsCommandS tyle.vsCommandS tylePictAndText ,
vsCommandContro lType.vsCommand ControlTypeButt on);

String toolsMenuName;
try
{
//If you would like to move the command to a different menu,
change the word "Tools" to the
// English version of the menu. This code will take the culture,
append on the name of the menu
// then add the command to that menu. You can find a list of all
the top-level menus in the file
// CommandBar.resx .
System.Resource s.ResourceManag er resourceManager = new
System.Resource s.ResourceManag er("MyAddinTest .CommandBar",
System.Reflecti on.Assembly.Get ExecutingAssemb ly());
System.Threadin g.Thread thread =
System.Threadin g.Thread.Curren tThread;
System.Globaliz ation.CultureIn fo cultureInfo =
thread.CurrentC ulture;
toolsMenuName =
resourceManager .GetString(Stri ng.Concat(cultu reInfo.TwoLette rISOLanguage
Name, "Tools"));
}
catch(Exception )
{
//We tried to find a localized version of the word Tools, but one
was not found.
// Default to the en-US word, which may work for the current
culture.
toolsMenuName = "Tools";
}

//Place the command on the tools menu.
//Find the MenuBar command bar, which is the top-level command bar
holding all the main menu items:
menuBarCommandB ar =
((CommandBars)a pplicationObjec t.CommandBars)["MenuBar"];

//Find the Tools command bar on the MenuBar command bar:
toolsControl = menuBarCommandB ar.Controls[toolsMenuName];
toolsPopup = (CommandBarPopu p)toolsControl;

//Find the appropriate command bar on the MenuBar command bar:
commandBarContr ol =
(CommandBarCont rol)command.Add Control(toolsPo pup.CommandBar, 1);
}
catch(Exception )
{
}
}
}

/// <summary>Implem ents the OnDisconnection method of the
IDTExtensibilit y2 interface. Receives notification that the Add-in is
being unloaded.</summary>
/// <param term='disconnec tMode'>Describe s how the Add-in is being
unloaded.</param>
/// <param term='custom'>A rray of parameters that are host application
specific.</param>
/// <seealso class='IDTExten sibility2' />
public void OnDisconnection (ext_Disconnect Mode disconnectMode, ref
Array custom)
{
}

/// <summary>Implem ents the OnAddInsUpdate method of the
IDTExtensibilit y2 interface. Receives notification when the collection
of Add-ins has changed.</summary>
/// <param term='custom'>A rray of parameters that are host application
specific.</param>
/// <seealso class='IDTExten sibility2' />
public void OnAddInsUpdate( ref Array custom)
{
}

/// <summary>Implem ents the OnStartupComple te method of the
IDTExtensibilit y2 interface. Receives notification that the host
application has completed loading.</summary>
/// <param term='custom'>A rray of parameters that are host application
specific.</param>
/// <seealso class='IDTExten sibility2' />
public void OnStartupComple te(ref Array custom)
{
}

/// <summary>Implem ents the OnBeginShutdown method of the
IDTExtensibilit y2 interface. Receives notification that the host
application is being unloaded.</summary>
/// <param term='custom'>A rray of parameters that are host application
specific.</param>
/// <seealso class='IDTExten sibility2' />
public void OnBeginShutdown (ref Array custom)
{
}

/// <summary>Implem ents the QueryStatus method of the IDTCommandTarge t
interface. This is called when the command's availability is
updated</summary>
/// <param term='commandNa me'>The name of the command to determine
state for.</param>
/// <param term='neededTex t'>Text that is needed for the
command.</param>
/// <param term='status'>T he state of the command in the user
interface.</param>
/// <param term='commandTe xt'>Text requested by the neededText
parameter.</param>
/// <seealso class='Exec' />
public void QueryStatus(str ing commandName, vsCommandStatus TextWanted
neededText, ref vsCommandStatus status, ref object commandText)
{
if(neededText ==
vsCommandStatus TextWanted.vsCo mmandStatusText WantedNone)
{
if(commandName == "MyAddinTest.Co nnect.MyAddinTe st")
{
status =
(vsCommandStatu s)vsCommandStat us.vsCommandSta tusSupported|vs CommandStatu
s.vsCommandStat usEnabled;
}
}
}

/// <summary>Implem ents the Exec method of the IDTCommandTarge t
interface. This is called when the command is invoked.</summary>
/// <param term='commandNa me'>The name of the command to
execute.</param>
/// <param term='executeOp tion'>Describes how the command should be
run.</param>
/// <param term='varIn'>Pa rameters passed from the caller to the
command handler.</param>
/// <param term='varOut'>P arameters passed from the command handler to
the caller.</param>
/// <param term='handled'> Informs the caller if the command was
handled or not.</param>
/// <seealso class='Exec' />
public void Exec(string commandName, vsCommandExecOp tion
executeOption, ref object varIn, ref object varOut, ref bool handled)
{
handled = false;
if(executeOptio n == vsCommandExecOp tion.vsCommandE xecOptionDoDefa ult)
{
if(commandName == "MyAddinTest.Co nnect.MyAddinTe st")
{
handled = true;
return;
}
}
}
private DTE2 applicationObje ct;
private AddIn addInInstance;
}
}

Thanks in advance for your help.

*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #1
0 1528

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1640
by: jmespinosabaviera | last post by:
1) Does visual studio standard 2005 include visual basic ?. 2) What difference is there between the visual studio standard 2005 and the professional version ? 3) What difference is there between the visual studio standard 2005 and the express version ? 4) How much does visual studio standard 2005 cost ?
1
1427
by: micky | last post by:
i've download vs studio team suite but it look like beta 2 CTP versio such as folder structure.. there are msdn, visio, vs ,vss folder and to check version this iso file i opened setup.ini and then i found the following text.... it says "Visual Studio&reg; 2005 Beta 2 Setup" as banner name value Ver=8.0
4
2529
by: Andrew Robinson | last post by:
My main dev machine has WinXp and VS2005 (pro). 1. I need to install VWD Express Edition so that I can do some instruction on this. Any issues with both on the same machine. Installation order? 2. Does VWD Express Edition support the idea of Solutions? I coun't figure out how to create a blank solution which I usually do with VS2005 (and then add my web site to the solution.)
2
1030
by: Ravimama | last post by:
Hi All, I have not yet seen Visual Studio 2005 and I could not collect much information on this. I just want to know whether Visual Stdio 2005 is enhanced Visual Studio ..net 2003 or is it Enhanced Visual Studio with Visual Basic 6.0. Is it ..net or the traditional Visual Basic 6.0 + with added features. Thanks.
2
1823
by: Nathan Sokalski | last post by:
I have a webhost that unfortunately does not yet support ASP.NET 2.0. This would not be a problem, except for the fact that most places no longer sell Visual Studio .NET 2003, which means I need to use Visual Studio .NET 2005 to compile a *.dll that is ASP.NET 1.1 compatible. I seem to remember hearing something about a way to do this with Visual Studio .NET 2005, but I cannot remember how, and I seem to remember it being a frustrating...
1
3270
by: Dane | last post by:
Does anyone know how to add Users to Groups using Visual Studio.net 2005? I am also trying to add them to the correct OU and finally I would like to change the directory to where there terminal services profiles are saved. THis is what I have thus far. Thanks! Protected Sub btnNewUser_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCreate.Click Dim oContainer As ActiveDs.IADsContainer Dim oUser As ActiveDs.IADsUser...
4
1924
by: =?Utf-8?B?ZGF2aWQ=?= | last post by:
We have to upgrade our Visual Studio .NET 2003 enterprise edition to .NET 2005. However, there is no enterprise edition for Visual Studio .NET 2005. There are 4 versions available for visual studio team edition 2005, Software Architect, Software Developer, Software Tester, and Team Suite which includes all three architect, developer, and tester. There are also professional and standard. Which is one is equivalent to Visual Studio .NET...
0
6680
by: marathoner | last post by:
I am currently migrating my Visual C++ 6.0 applications to Visual Studio 2005. I am getting compiler errors involving the VS2005's platform SDK. When I removed directory references to that SDK, and started using the Microsoft Platform SDK for XP SP2, the errors disappeared, but I am now getting numerous warnings (macro redefinitions) as follows: StdAfx.cpp WINVER not defined. Defaulting to 0x0502 (Windows Server 2003) C:\Program...
1
2503
by: Dr T | last post by:
Hi! I downloaded MS Visual Web Developer 2005 Express Edition, MS .NET Framework SDK v2.0, and MS SQL Server 2005. Subsequently, I bought MS Visual Studio 2005 Professional Edition. 1) Are both the MS Visual Web Developer 2005 Express Edition and the MS Visual Studio 2005 Professional Edition used to develop .ASP applications?
7
2468
by: =?Utf-8?B?UHJhamFrdGE=?= | last post by:
We have an application build on Microsoft Visual Studio 2002 .Net 1.0 ie on 32 bit. Can we port the same application for .NET 2.0. Does .NET 2.0 is supported on Microsoft Visual studio 2002 ie for 32 bit application as .NET 2.0 is supported on Microsoft Visual studio 2005. And if yes How .NET 1.0 is to be upgraded to 2.0 on Microsoft visual studio 2002.
0
8837
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9366
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9214
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9130
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8005
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4484
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3187
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2572
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2129
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.