Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / Extensibility / October 2005

Tip: Looking for answers? Try searching our database.

Add-In not under Tools anymore - VS.Net 2005 version 8.0.50727.26 (latest release)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Giganews - 27 Oct 2005 17:40 GMT
VS.Net 2005 8.0.50727.26 (latest release version)
C++ Add-in

I have an Add-in that loaded fine in the beta version of VS.Net 2005.  I had
to recompile my VS C++ 2002/2003 code with the 2005 libraries, and it worked
the same after that.

I recompiled with the latest release and installed as usual.  The add-in
manager shows my add-in as being available and startup is checked.  The menu
item "Customize\commands\Addins" shows the name of my add-in and the icon it
gets from the satellite dll.

The problem is that my add-in no longer shows up above "Attach to process"
in the Tools menu.  Is there a change that happened recently?  If so, are
there some updated samples?  Perhaps something new is needed at
HKLM\SOFTWARE\Microsoft\VisualStudio\8.0\Addins.

Thanks. Jackie
Carlos J. Quintero [VB MVP] - 28 Oct 2005 09:17 GMT
Are you using a permanent toolbar (DTE.Commands.AddCommandBar) or a
temporary toolbar (DTE.CommandBars.Add) ?
In the former case, have you tried to reset the Preload flag to get UISetup
phase called again to recreate the UI?
In the latter case, can´t you debug the OnConnection event to see why the UI
is not created?

Signature

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com

> VS.Net 2005 8.0.50727.26 (latest release version)
> C++ Add-in
[quoted text clipped - 14 lines]
>
> Thanks. Jackie
jjudge - 28 Oct 2005 22:51 GMT
The add-in loads and functions fine if I manually add it via
"Tools\Customize\Rearrange Commands", so it does appear to function at
least.

Here's the registry settings under Addins.

HKLM\SOFTWARE\Microsoft\VisualStudio\8.0\Addins\AddIn_NET.Connect\CommandPreload
= 1
HKLM\SOFTWARE\Microsoft\VisualStudio\8.0\Addins\AddIn_NET.Connect\LoadBehavior
= 1
HKLM\SOFTWARE\Microsoft\VisualStudio\8.0\Addins\AddIn_NET.Connect\FriendlyName
= "Formal Add In Name"
HKLM\SOFTWARE\Microsoft\VisualStudio\8.0\Addins\AddIn_NET.Connect\SatelliteDLLName=AddIn_NETSatellite_2005.dll
HKLM\SOFTWARE\Microsoft\VisualStudio\8.0\Addins\AddIn_NET.Connect\SatelliteDLLPath=C:\Program
Files\Microsoft Visual Studio 8\Common7\IDE

Under PreloadAddinState:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\PreloadAddinState\AddIn_NET.Connect=1

Perhaps, the code could stand improvement - although it functioned before.
We're using DTE.CommandBars.AddControl(), but the code doesn't make it that
far.  It does not get past "if(ConnectMode ==
AddInDesignerObjects::ext_cm_UISetup)" below.  If I comment that out,
DTE.Commands.AddNamedCommand() fails - probably because it is not at the
proper ConnectMode.  I can debug the 2002/2003 version to see what it used
to do if needed.

Here's OnConnection():

#define IfFailGoCheck(x, p) { hr=(x); if (FAILED(hr)) goto Error; if(!p) {hr
= E_FAIL; goto Error; } }

STDMETHODIMP CConnect::OnConnection(IDispatch *pApplication,
AddInDesignerObjects::ext_ConnectMode ConnectMode, IDispatch *pAddInInst,
SAFEARRAY ** /*custom*/ )
{
   AFX_MANAGE_STATE(AfxGetStaticModuleState())
   HRESULT hr = S_OK;
   m_pApplication = pApplication;
   pApplication->QueryInterface(__uuidof(EnvDTE::_DTE), (LPVOID*)&m_pDTE);
   pAddInInst->QueryInterface(__uuidof(EnvDTE::AddIn),
(LPVOID*)&m_pAddInInstance);

   if(ConnectMode == AddInDesignerObjects::ext_cm_UISetup)  // Does not get
this far unless commented out.
   {
       hr = S_OK;
       CComPtr<EnvDTE::Commands> pCommands;
       CComPtr<Office::_CommandBars> pCommandBars;
       CComPtr<Office::CommandBarControl> pCommandBarControl;
       CComPtr<EnvDTE::Command> pCreatedCommand;
       CComPtr<Office::CommandBar> pMenuBarCommandBar;
       IfFailGoCheck(m_pDTE->get_Commands(&pCommands), pCommands);

       // Fails with invalid argument.
       if(SUCCEEDED(hr = pCommands->AddNamedCommand(m_pAddInInstance,
CComBSTR("AddIn"),
          CComBSTR("Formal Add In Name"), CComBSTR("Formal Add In Name"),
VARIANT_FALSE, 1, NULL,
          EnvDTE::vsCommandStatusSupported+EnvDTE::vsCommandStatusEnabled,
&pCreatedCommand)) &&
          (pCreatedCommand))
       {
           try
           {
                // This code had to be changed slightly to compile in
VS.Net 2005:
                if ((hr =
m_pDTE->get_CommandBars((IDispatch**)&pCommandBars)) != S_OK)
                   throw hr;
                if ((hr = pCommandBars->get_Item(CComVariant(L"Tools"),
&pMenuBarCommandBar)) != S_OK)
                   throw hr;
                if ((hr = pCreatedCommand->AddControl(pMenuBarCommandBar,
1, (IDispatch**)&pCommandBarControl)) != S_OK)
                   throw hr;
         }
         catch (int i)
        {
                  return i;
         }
         catch (_com_error err)
        {
             ::MessageBox(NULL, err.ErrorMessage(), "ERROR", IDOK);
         }
   }
   return S_OK;

}
Error:
return hr;
}

Thanks, Jackie

> Are you using a permanent toolbar (DTE.Commands.AddCommandBar) or a
> temporary toolbar (DTE.CommandBars.Add) ?
[quoted text clipped - 21 lines]
>>
>> Thanks. Jackie
jjudge - 31 Oct 2005 18:24 GMT
I tried DTE.Commands.AddCommandBar, and it works fine in VS.Net 2005.
Thanks.

> Are you using a permanent toolbar (DTE.Commands.AddCommandBar) or a
> temporary toolbar (DTE.CommandBars.Add) ?
[quoted text clipped - 21 lines]
>>
>> Thanks. Jackie

Free Magazines

Get 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 ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.