Adding Host Items

Latest post 04-25-2008 7:37 PM by rszografos. 4 replies.
  • 04-25-2008 12:03 AM

    • Terry
    • Top 10 Contributor
    • Joined on 05-10-2006
    • Posts 52

    Adding Host Items

    Armed with some (what I think are good) ideas I'm trying to proof out some possible designs.  Part of this is to load a Host Item into the DTE.  I've gone through the steps I believe are necessary:

     - Added a new class to my application's object model

     - Created an updated proxy, adding the entryPoint="true" to this new class in addition to the primary class that is identified in the ProjectGen.exe screen.

     - Added code to create a project from the template.

     - Added code to Add the Host Item.

    It's this las step that is causing the trouble because it wants a template file to use when creating the HostItemClass.  I can't find any doco on how to make one of these.  I tried just copying the one from my primary HostItem that ProjectGen created and updating the obvious stuff but that creates a number of run-time issues once I load it into the DTE.

    What's the correct way to create a tempate file that the AddProjectHostItem() method will like?

    Thx.

  • 04-25-2008 1:17 AM In reply to

    • Terry
    • Top 10 Contributor
    • Joined on 05-10-2006
    • Posts 52

    Re: Adding Host Items

    After some hacking I was able to manually modify the designer and the partial classes to get my new HostItem to compile.  I was then able to load the addin using the MultipleEntryPoint method and fire events, both startup and custom.

    So, all the plumbing seems to work.  I just need to know how to create the class templates so I don't have to manually edit/fix the HostItem class files after adding them to the designer.

    Thx.

  • 04-25-2008 12:27 PM In reply to

    Re: Adding Host Items

    Another missing piece to this little puzzle...  I see an .xsd file in the VSTA schemas for HostItem3, but that is for the HostItemBlueprint.  The setup script adds a project host item directory to the registry, but I don't see where that is used.

    I'm going to ask MSFT for enlightenment here.

    In the MEANTIME, would it be possible to create your own Project HostItem template files by copying the ones in the ShapeAppDynamicProgrammingModel sample? Be sure to use 

    [!output SAFE_CLASS_NAME] for identifying the item name. 

  • 04-25-2008 2:36 PM In reply to

    • Terry
    • Top 10 Contributor
    • Joined on 05-10-2006
    • Posts 52

    Re: Adding Host Items

    Yea, I thought about trying to steal their existing templates and modify, but really didn't understand the syntax.  That's why I just hacked at the raw code until it worked.  Clearly this is just a quick fix so I could move on to writing the code to do the loading/unloading and debugging/code editing stuff.

    Will be interesting to see how it's supposed to be done...

  • 04-25-2008 7:37 PM In reply to

    Re: Adding Host Items

    I got the straight story from MSFT...

    You need to create your own project host item template. However, there are two string "substitutions" that you can use to make the template more generic: [!output SAFE_NAMESPACE_NAME] and [!output SAFE_CLASS_NAME]. You can use these to generically identify the namespace or the class in the template - these values are used in a string substitution. The DPM sample drawing.cs demonstrates.

    The project host item template directory name that is registered in the setup script of the DPM sample is just something used in this particular sample and it is not actually used by VSTA itself.

    Microsoft will look into adding some documentation about the project host item template file.

    If you have any questions about how to create your own project host item template file, let me know. I think we can get that going.

     

     

Page 1 of 1 (5 items) | RSS
Copyright Summit Software Company, 2008. All rights reserved.