IVsSolutionBuildManager2.SaveDocumentsBeforeBuild Method

Definition

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

C++/CX
public:
 int SaveDocumentsBeforeBuild(Microsoft::VisualStudio::Shell::Interop::IVsHierarchy ^ pHier, unsigned int itemid, unsigned int docCookie);

Parameters

pHier
IVsHierarchy

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

itemid
UInt32

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

docCookie
UInt32

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

Returns

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

Remarks

COM Signature

From vsshell.idl:

cpp#
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.

Applies to

Proizvod Verzije
Visual Studio SDK 2015, 2017, 2019, 2022