Add toolbox item programatically

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Christina Androne

    #1

    Add toolbox item programatically

    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
  • Greg Ewing [MVP]

    #2
    Re: Add toolbox item programatically

    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 "Extensibil ity Reference"
    under the Reference section.

    Hope that's helpful.

    --
    Greg Ewing [MVP]
    IT support built exclusively for nonprofits. 25 years of managed IT, help desk, and cybersecurity - so your team can focus on your mission.



    "Christina Androne" <achristina@hom e.ro> wrote in message
    news:Odz01SbmDH A.2500@TK2MSFTN GP10.phx.gbl...[color=blue]
    > 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[/color]


    Comment

    • Christina Androne

      #3
      Re: Add toolbox item programatically

      Greg Ewing [MVP] wrote:
      [color=blue]
      > Christina, it's even simpler than that. Start a new Extensibility
      > project.[/color]

      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

      Comment

      • Gabriel Esparza-Romero [MSFT]

        #4
        Re: Add toolbox item programatically

        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.GetActi veObject, 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 Esparza-Romero, Visual C# Team
        This posting is provided "AS IS" with no warranties, and confers no rights.
        Use of included script samples are subject to the terms specified at
        http://www.microsoft.com/info/cpyright.htm

        Comment

        • Christina Androne

          #5
          Re: Add toolbox item programatically

          Gabriel Esparza-Romero [MSFT] wrote:
          [color=blue]
          > 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).[/color]

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

          I'll investigate this
          [color=blue]
          > - 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.GetActi veObject, 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)).[/color]

          What about this approach?

          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




          Comment

          • Greg Ewing [MVP]

            #6
            Re: Add toolbox item programatically

            Christina, out of curiosity, why does your team lead not want to create an
            add-in?

            --
            Greg Ewing [MVP]
            IT support built exclusively for nonprofits. 25 years of managed IT, help desk, and cybersecurity - so your team can focus on your mission.


            "Christina Androne" <achristina@hom e.ro> wrote in message
            news:eR6eUxnmDH A.1800@TK2MSFTN GP10.phx.gbl...[color=blue]
            > Gabriel Esparza-Romero [MSFT] wrote:
            >[color=green]
            > > 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).[/color]
            >
            > This has been rejected by my team leader, we have to wite separate app
            > that adds the toolbox item.
            >[color=green]
            > > - create a macro (check Tools->Macros->Macros IDE)[/color]
            >
            > I'll investigate this
            >[color=green]
            > > - 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.GetActi veObject, 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)).[/color]
            >
            > 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
            >
            >
            >
            >[/color]


            Comment

            • Christina Androne

              #7
              Re: Add toolbox item programatically

              Greg Ewing [MVP] wrote:
              [color=blue]
              > Christina, out of curiosity, why does your team lead not want to
              > create an add-in?[/color]

              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

              Comment

              • Christina Androne

                #8
                Re: Add toolbox item programatically

                Christina Androne wrote:
                [color=blue]
                > Greg Ewing [MVP] wrote:
                >[color=green]
                > > Christina, out of curiosity, why does your team lead not want to
                > > create an add-in?[/color][/color]

                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.ToolBox Items.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

                Comment

                Working...