Adding Custom Control via. Installer or batch file

  • Thread starter Thread starter Fred Chen
  • Start date Start date
F

Fred Chen

I've created a custom control (that will be used for a Smart Device
project)
and I would like to add it to the Toolbox in VS.NET 2003, but I don't
want to have to manually add it by right-clicking the toolbox,
choosing add/remove, etc.

Is there a way to add the custom control to the IDE through a batch
file? My application has an installer that will copy the custom
control dlls to the proper places, now I just need the installer to
add the custom control to the toolbox? Does anyone know how to do
this?

Thanks,
Fred
 
Unfortunately, the toolbox data isn't stored in the registry.

You can do this 1 of 2 ways:
1. Use DTE extensibility to add your item. Write an application that uses
DTE extensibiliy (add envDTE as a reference to your project) and add a
toolbox item this way. It will looks something like:

ToolboxTab newTab = DTE.Toolbox.ToolBoxTabs.Add("MyTopLevelTab")
newTab.ToolBoxItems.Add("Title", MyToolboxItem,
EnvDTE.vsToolBoxItemFormat.vsToolBoxItemFormatDotNETComponent)

where MyToolboxItem is of type System.Drawing.Design.ToolboxItem (I
believe). You may have to get the IDataObject from this toolboxitem before
passing it in.

2. The second way to do this is to create your own VSPackage. This is a
better method if you care about versioning your component, updating the
toolbox, etc. Also, if you go with option #1 and the user "Resets" his
toolbox, your component will be lost until your extensibility program is
run again.

To write this VS package, you need to implement
IVsPackage::ResetDefaults. You will need to be a VSIP customer to do this
as your package will need a loadkey and you need more documentation than I
can put here. There are samples in the environment SDK that cover this
scenario.

I hope some of this helped.

-Ben

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| From: "Chris Tacke, eMVP" <[email protected]>
| References: <[email protected]>
| Subject: Re: Adding Custom Control via. Installer or batch file
| Date: Mon, 7 Jul 2003 20:30:27 -0400
| Lines: 23
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| NNTP-Posting-Host: md-frdrck-cmts1a-a-231.shphwv.adelphia.net
68.67.192.231
| Path: cpmsftngxa09.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11.phx.gbl
| Xref: cpmsftngxa09.phx.gbl
microsoft.public.dotnet.framework.compactframework:10078
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
| capture your PC registry before and after adding the control, then diff
the
| two files. You'll probably see the difference.
|
| -Chris
|
| | > I've created a custom control (that will be used for a Smart Device
| > project)
| > and I would like to add it to the Toolbox in VS.NET 2003, but I don't
| > want to have to manually add it by right-clicking the toolbox,
| > choosing add/remove, etc.
| >
| > Is there a way to add the custom control to the IDE through a batch
| > file? My application has an installer that will copy the custom
| > control dlls to the proper places, now I just need the installer to
| > add the custom control to the toolbox? Does anyone know how to do
| > this?
| >
| > Thanks,
| > Fred
|
|
|
 
Back
Top