views:

49

answers:

2

Hello, I have a plug-in that I use with Visual Studio 2008. I am testing 2010 and one of the problems I am seeing is the fact that the plug-in doesn't get loaded anymore.
This is the command I am using to add my plug-in:

toolsMenuName = "Tools"; 

Microsoft.VisualStudio.CommandBars.CommandBar menuBarCommandBar = ((CommandBars)_applicationObject.CommandBars)["MenuBar"];


CommandBarControl toolsControl = menuBarCommandBar.Controls[toolsMenuName];
var toolsPopup = (CommandBarPopup)toolsControl;


try
{

Command command = commands.AddNamedCommand2(_addInInstance, "TestData", "Test Data", "", true, 0, ref contextGUIDS, (int)vsCommandStatus.vsCommandStatusSupported + (int)vsCommandStatus.vsCommandStatusEnabled, (int)vsCommandStyle.vsCommandStylePictAndText, vsCommandControlType.vsCommandControlTypeButton);


if ((command != null) && (toolsPopup != null))
{
command.AddControl(toolsPopup.CommandBar, 1);
}
}
catch (ArgumentException)
{

}

What has changed in VS 2010?

Thanks Tony

A: 

A lot has changed but mainly the clr version has changed, Net 2.0 from 3.5 use clr 2.0. Net 4.0 uses the new clr, so chances are this is the culprit

Regards

serguey123
A: 

I have an add-in that works in 2005 and 2008 (targetting .net 2.0), and I had to make no changes to get it working in 2010. So, fundamentally a .net 2.0 add-in can work in 2010 (although you may need to tweak a few things to make it work perfectly, the fundamentals of loading and adding a command haven't changed)

This suggests that it's probably a simple glitch - I'd suspect:

  • There is something wrong in your .Addin file, or it is not on the VS2010 add-ins path, so it is not being loaded by VS2010, or
  • The add-in is loading, but is not adding its commands successfully.

The first thing I would suggest is therefore to check if it is loading ok. Go to Tools->Add-In Manager and see if it is listed and checked. If not, then it's either not on the add-ins path, or your MyAddin.Addin file isn't correct (has the XML been updated to target version 10.0 of the IDE or is it still saying version 9.0?)

If it's loading ok, then you need to run it under a debugger to see why your command isn't registering correctly.

Jason Williams
I am quite new to this topic and I have inherited a working process for VS2008. From what I could find and your reply I guess I was looking in the wrong place for the problem I am having. I am calling VS2010 instead of 2008 now. When the package installs I can see VS2010 running when the installer is triggered. The command called to install the add-in: devenv.exe + "/resetaddin " + addinName + " /Command File.Exit";Not sure the value of addinName (I don't know how to debug the installer call). BTW, The add-in is not listed in the Add-in Manager after installation.
tony
The problem definitely sounds like it's the install rather than starting up and adding the command. If you have an .Addin file, then you should be able to manually install the plugin like this: Save the .Addin and .dll files somewhere (e.g. C:\MyAddin). Edit the .Addin file and enter the dll's path into the <Assembly> element, i.e. <Assembly>C:\MyAddin\MyAddin.dll</Assembly>. Run VS and go to Tools>Options: Add-in/Macros security. Check that "Allow add in components to load" is checked. Click Add... to add C:\MyAddin to the paths. Restart and check if your addin appears in Tools>Addin manager
Jason Williams
If it's a Package, then the Package Load Analyser may help you diagnose problems (I don't know for sure, but it sounds useful). http://msdn.microsoft.com/en-us/library/bb286997(VS.80).aspx
Jason Williams
It looks now that the issues I have are more challenging then what I initially thought. I tried the suggested steps. It looks like I have more than 1 issue to solve. I successfully added the add-in using the 'Add' button. The add-in crashes VS2010 though every time I try to access the Tools menu. I had to remove the add-in using the 'option' from another menu path.
tony
If you're getting it to load, you should be able to run visual studio under a debugger to debug into the add-in and see where it's crashing. Try http://msdn.microsoft.com/en-us/library/f7fb383x.aspx or google for more help on debugging addins
Jason Williams