IVsAsyncShellOpenDocument.OpenDocumentViaProjectAsync Method

Definition

Finds an appropriate project to open the document.

public Microsoft.VisualStudio.Shell.Interop.IVsTask OpenDocumentViaProjectAsync (string documentMoniker, Guid logicalView, bool supportExternalItems);
abstract member OpenDocumentViaProjectAsync : string * Guid * bool -> Microsoft.VisualStudio.Shell.Interop.IVsTask
Public Function OpenDocumentViaProjectAsync (documentMoniker As String, logicalView As Guid, supportExternalItems As Boolean) As IVsTask

Parameters

documentMoniker
String

String form of the unique moniker identifier of the document in the project system, for example, the full path to the file. In non-file cases, this identifier is often in the form of a URL.

logicalView
Guid

A Guid identifying the logical view. The default view is VSConstants.LOGVIEWID_Primary and every editor must support that view.

If the editor implements IVsMultiViewDocumentView on the document view object, then the value passed to ActivateLogicalView(Guid), which determines which view is activated when the editor window is shown.

By specifying the logical view Guid, you can request the specific view that matches the reason you are requesting the view. For example, specify VSConstants.LOGVIEWID_Debugging to get the view appropriate for debugging, or VSConstants.LOGVIEWID_TextView to get the view appropriate for the text editor (that is, a view that implements IVsCodeWindow).

supportExternalItems
Boolean

true if the project supports external items; otherwise, false.

Returns

A task representing the open operation. The result of the task is an IVsAsyncOpenDocumentResult object.

Remarks

The task returned by this method does not indicate that the document's view and docdata have been loaded. See DocumentLoadTask for more details.

This can be called to open any project that is opened through the New Project or Open Project dialog box. In addition, this method is also called to open a document in any project that is added to the solution through AddVirtualProject(IVsHierarchy, UInt32) or AddVirtualProjectEx(IVsHierarchy, UInt32, Guid). One example use of this is the DataView hierarchy, which is currently in Server Explorer. If a DataView hierarchy is added to the solution as a virtual project using AddVirtualProject(IVsHierarchy, UInt32), then this method can open items from DataView hierarchies. This functionality is important as it makes debugging of stored procedures possible.

This method must be accessed on the main thread.

Applies to