共用方式為


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.

public:
 int SaveDocumentsBeforeBuild(Microsoft::VisualStudio::Shell::Interop::IVsHierarchy ^ pHier, System::UInt32 itemid, System::UInt32 docCookie);
public:
 int SaveDocumentsBeforeBuild(Microsoft::VisualStudio::Shell::Interop::IVsHierarchy ^ pHier, unsigned int itemid, unsigned int docCookie);
int SaveDocumentsBeforeBuild(Microsoft::VisualStudio::Shell::Interop::IVsHierarchy const & pHier, unsigned int itemid, unsigned int docCookie);
public int SaveDocumentsBeforeBuild (Microsoft.VisualStudio.Shell.Interop.IVsHierarchy pHier, uint itemid, uint docCookie);
abstract member SaveDocumentsBeforeBuild : Microsoft.VisualStudio.Shell.Interop.IVsHierarchy * uint32 * uint32 -> int
Public Function SaveDocumentsBeforeBuild (pHier As IVsHierarchy, itemid As UInteger, docCookie As UInteger) As Integer

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:

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