The VSTA SDK provides samples and help topics that show you how to dynamically add host items to VSTA add-in projects. However, If you've read the topic "How to: Add and Remove Host Items in an Add-in Project", you might have been a bit confused by the following code snippet:
Where did the value of this last parameter come from? The documentation does not make this very clear, so I will quickly explain.
This parameter refers to the location of a host item template.
The host item template is just a file that contains code that want to appear inside of a host item class that you dynamically create.
The code featured in the example above refers to the host item template that ships with the samples. For your application, you must create your own host item template. Your template does not have to match the one featured in the sample. It can contain anything that you want.
However, you might want to make use of two replacement variables that are featured in the host item template of the sample: [!output SAFE_NAMESPACE_NAME] and [!output SAFE_CLASS_NAME].
VSTA will replace these variables when you create the host item. [!output SAFE_NAMESPACE_NAME] is replaced with the namespace of your add-in project and [!output SAFE_CLASS_NAME] is replaced with the name (first parameter) that you pass into the AddProjectHostItem() method.
Once you have created your host item template, you can pass the location of that template to the AddProjectHostItem method to create host item classes in your add-in project.