Add toolbox item programatically

  • Thread starter Thread starter Christina Androne
  • Start date Start date
C

Christina Androne

Hello everybody!

Has anybody developed an app which adds a toolbox item to the .NET IDE
designer? Or knows the steps to do so? Or knows some good tutorials on
this? I have a starting point, the IToolboxService interface, but till
now it didn't work out for me.

Any help is really welcomed,

Christina Androne
 
Christina, it's even simpler than that. Start a new Extensibility project.
The wizard will ask you what application you want to extend and then set
everything up for you. For help on add-ins and the Visual Studio Object
model, check under the
"Extending the Visual Studio Environment" topic in the "Developing with
Visual Studio.NET" help collection as well as the "Extensibility Reference"
under the Reference section.

Hope that's helpful.
 
Greg said:
Christina, it's even simpler than that. Start a new Extensibility
project.

Thank you for your answer, but unfortunately, I have to find another
solution, without using and addin (team leader says this). Do you know
other solution I can use?



Christina Androne
 
There are several ways to interact with the VS object model that Greg
mentions.

You can:
- create an addin (essentially an assebly that loads within the VS process).
- create a macro (check Tools->Macros->Macros IDE)
- create a separate exe that opens VS and manipulates it through the object
model or manipulates a currently open instance of VS (you can get a
reference to a running instance of VS by using Marshal.GetActiveObject, if
there's more than one version of VS that's open you would need to do some
extra work to determine which VS you want to manipulate (you would have to
enumerate the elements of the Running Object Table, as far as I know you
would have to invoke the native methods because the framework does not
support this)).
 
Gabriel said:
There are several ways to interact with the VS object model that Greg
mentions.

You can:
- create an addin (essentially an assebly that loads within the VS
process).

This has been rejected by my team leader, we have to wite separate app
that adds the toolbox item.
- create a macro (check Tools->Macros->Macros IDE)

I'll investigate this
- create a separate exe that opens VS and manipulates it through the
object model or manipulates a currently open instance of VS (you can
get a reference to a running instance of VS by using
Marshal.GetActiveObject, if there's more than one version of VS
that's open you would need to do some extra work to determine which
VS you want to manipulate (you would have to enumerate the elements
of the Running Object Table, as far as I know you would have to
invoke the native methods because the framework does not support
this)).

What about this approach?
http://techrepublic.com.com/5100-6329-5034244.html
I tried to follow the steps from hte article, but, this line a code
raises an exception I have described in another post: EnvDTE.DTE env =
new EnvDTE.DTE();

Untill now, if we figure how to avoid that 1.1 framework bug, most
probably this will be the solution we will choose. The drawback is that
adding components to toolbox is far too slow. We have to add arround 30
components from the same dll. Is there a method of adding all
components from a dll at once? I understood that, for adding component
by component, the IDE loads and frees the dll every time, which is time
consuming.



Thanks for answering,
Christina Androne
 
Christina, out of curiosity, why does your team lead not want to create an
add-in?
 
Greg said:
Christina, out of curiosity, why does your team lead not want to
create an add-in?

That was the way the project used to be untill now, but for some
reason, he decided it's better to have a different application for
adding the components to the toolbox. I am not sure, but I think the
main reason was that the addin approach was too slow, like I said in
the previous post.



Christina Androne
 
Acctully, if I think better, the add-in approach was rejected because
of the method used for adding the toolbox items, which are all located
in the same DLL (we are using ToolBox.ToolBoxItems.Add(...) ). He
thinks that adding component by component is not pretty smart since
that means loading and freeing the assembly for every component. What
we really need right now is a faster method for adding the assembly's
controls.


Christina Androne
 
Back
Top