IVsSolutionBuildManager2::SaveDocumentsBeforeBuild Method (IVsHierarchy^, UInt32, UInt32)

 

A project calls this method to ensure that the buildable/runnable components of projects are saved before starting build or run operations.

Namespace:   Microsoft.VisualStudio.Shell.Interop
Assembly:  Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)

int SaveDocumentsBeforeBuild(
	IVsHierarchy^ pHier,
	unsigned int itemid,
	unsigned int docCookie
)

Parameters

pHier
Type: Microsoft.VisualStudio.Shell.Interop::IVsHierarchy^

[in] Pointer to the IVsHierarchy object of a project.

itemid
Type: System::UInt32

[in] Specifies VSITEMID. This is the VSITEMID corresponding to a single document in the project hierarchy.

docCookie
Type: System::UInt32

[in] Specifies the document cookie; an abstract handle to the document returned when it was registered with IVsRunningDocumentTable.

Return Value

Type: System::Int32

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

From vsshell.idl:

HRESULT IVsSolutionBuildManager2::SaveDocumentsBeforeBuild(
   [in] IVsHierarchy *pHier,
   [in] VSITEMID itemid,
   [in] VSCOOKIE docCookie
);

If a project implements its own build/run mechanism to support a more granular level than the entire project, the project calls this method to ensure that the environment saves its buildable or runnable components before it starts building or running.

This method respects the user setting given by the VSSPROPID_PreBuildRunPreview environment property and will prompt for save or don't save accordingly.

Also documents registered with RDT_CanBuildFromMemory will not be saved.

Return to top
Show: