ProjectHostItemCollection.AddProjectHostItem Method (String, String, String, String, String, Boolean)
Adds a new host item to the project based on the specified host item information, and optionally generates code for the new host item.
Namespace: Microsoft.VisualStudio.Tools.Applications.DesignTime
Assembly: Microsoft.VisualStudio.Tools.Applications.DesignTime.v9.0 (in Microsoft.VisualStudio.Tools.Applications.DesignTime.v9.0.dll)
Syntax
'Declaration
Public Function AddProjectHostItem ( _
name As String, _
baseType As String, _
interfaceType As String, _
cookie As String, _
templatePath As String, _
generateCode As Boolean _
) As IVstaProjectHostItem
'Usage
Dim instance As ProjectHostItemCollection
Dim name As String
Dim baseType As String
Dim interfaceType As String
Dim cookie As String
Dim templatePath As String
Dim generateCode As Boolean
Dim returnValue As IVstaProjectHostItem
returnValue = instance.AddProjectHostItem(name, _
baseType, interfaceType, cookie, _
templatePath, generateCode)
public IVstaProjectHostItem AddProjectHostItem(
string name,
string baseType,
string interfaceType,
string cookie,
string templatePath,
bool generateCode
)
public:
IVstaProjectHostItem^ AddProjectHostItem(
String^ name,
String^ baseType,
String^ interfaceType,
String^ cookie,
String^ templatePath,
bool generateCode
)
public function AddProjectHostItem(
name : String,
baseType : String,
interfaceType : String,
cookie : String,
templatePath : String,
generateCode : boolean
) : IVstaProjectHostItem
Parameters
name
Type: System.StringThe identifier of the host item to add.
baseType
Type: System.StringThe fully qualified name of the base proxy class of the host item.
interfaceType
Type: System.StringThe fully qualified name of the Visual Studio Tools for Applications base runtime interface type.
cookie
Type: System.StringThe string value that uniquely identifies a specific instance of the host item to add.
templatePath
Type: System.StringThe full path of the host item template file excluding the file name extension.
generateCode
Type: System.Booleantrue to auto-generate code in the designer code file for the new host item; false to not generate any code.
Return Value
Type: Microsoft.VisualStudio.Tools.Applications.DesignTime.Interop.IVstaProjectHostItem
The new host item object that was added to the project.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | The name, baseType, interfaceType, or templatePath parameters are null or empty strings, or the cookie parameter is null. |
ArgumentException | The host item name represented by the name parameter already exists or is invalid, or the baseType or interfaceType is not a valid fully qualified name. |
Remarks
Pass false for the generateCode parameter if you want to provide custom code. Calling this method with false for the generateCode parameter adds an empty designer code file and empty XML blueprint file to the project.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
ProjectHostItemCollection Class
ProjectHostItemCollection Members
Microsoft.VisualStudio.Tools.Applications.DesignTime Namespace