IVsSolution.AddVirtualProject Method
Adds a type of virtual project that is not created by clicking Open Project on the New menu to open the solution.
Namespace: Microsoft.VisualStudio.Shell.Interop
Assembly: Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)
Syntax
'宣言
Function AddVirtualProject ( _
pHierarchy As IVsHierarchy, _
grfAddVPFlags As UInteger _
) As Integer
'使用
Dim instance As IVsSolution
Dim pHierarchy As IVsHierarchy
Dim grfAddVPFlags As UInteger
Dim returnValue As Integer
returnValue = instance.AddVirtualProject(pHierarchy, _
grfAddVPFlags)
int AddVirtualProject(
IVsHierarchy pHierarchy,
uint grfAddVPFlags
)
int AddVirtualProject(
[InAttribute] IVsHierarchy^ pHierarchy,
[InAttribute] unsigned int grfAddVPFlags
)
function AddVirtualProject(
pHierarchy : IVsHierarchy,
grfAddVPFlags : uint
) : int
Parameters
pHierarchy
Type: Microsoft.VisualStudio.Shell.Interop.IVsHierarchy[in] Pointer to the IVsHierarchy interface for the virtual project object. This object must support at least the following interfaces: IVsHierarchyIVsUIHierarchyIVsProject
grfAddVPFlags
Type: System.UInt32[in] Determines whether to add a new virtual project to the Solution Explorer. For a list of grfAddVPFlags, see __VSADDVPFLAGS.
Return Value
Type: System.Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.
Remarks
COM Signature
From vsshell.idl:
HRESULT IVsSolution::AddVirtualProject(
[in] IVsHierarchy *pHierarchy,
[in] VSADDVPFLAGS grfAddVPFlags
);
Virtual projects are created by another facility that manages the project, and then they are added to the solution. This method makes it possible for these project hierarchies to participate in the GetProjectEnum project enumeration. You must include EPF_VIRTUAL flag in the call to GetProjectEnum if virtual projects are to be included in the enumeration. If EPF_ALL is specified, virtual projects are not included.
A virtual project is an IVsHierarchy interface item that behaves as a project in that it is a container of items (documents), but it is not a real project because it is not created by clicking Project on the New menu. Examples of virtual projects are the DataView hierarchies. These hierarchies are containers for stored procedures, tables, views, schema diagrams, and so on. By adding a DataView hierarchy as a virtual project, the OpenDocumentViaProject method can open items from DataView hierarchies. This functionality is important, as it makes possible the debugging of stored procedures.
Note
Use the RemoveVirtualProject method to close a virtual project.
Permissions
- 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.