473,608 Members | 2,263 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 1527

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

Similar topics

1
1632
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
1417
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
2516
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
1029
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
1818
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
3267
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
1918
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
6665
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
2498
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
2461
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
8002
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8496
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...
1
8148
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
8338
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6013
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5475
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3962
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
2474
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
0
1329
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.