ProjectHostItemCollection.AddProjectHostItem Method (String, String, String, String, String)
Adds a new host item to the project based on the specified host item information, and 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 _
) 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 returnValue As IVstaProjectHostItem
returnValue = instance.AddProjectHostItem(name, _
baseType, interfaceType, cookie, _
templatePath)
public IVstaProjectHostItem AddProjectHostItem(
string name,
string baseType,
string interfaceType,
string cookie,
string templatePath
)
public:
IVstaProjectHostItem^ AddProjectHostItem(
String^ name,
String^ baseType,
String^ interfaceType,
String^ cookie,
String^ templatePath
)
public function AddProjectHostItem(
name : String,
baseType : String,
interfaceType : String,
cookie : String,
templatePath : String
) : 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.
cookie
Type: System.StringA name that identifies a unique instance of a project host item.
templatePath
Type: System.StringThe full path of the host item template file excluding the file name extension.
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. |
.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