IVsSolutionBuildManager2.SaveDocumentsBeforeBuild Method

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)

Syntax

'宣言
Function SaveDocumentsBeforeBuild ( _
    pHier As IVsHierarchy, _
    itemid As UInteger, _
    docCookie As UInteger _
) As Integer
'使用
Dim instance As IVsSolutionBuildManager2
Dim pHier As IVsHierarchy
Dim itemid As UInteger
Dim docCookie As UInteger
Dim returnValue As Integer

returnValue = instance.SaveDocumentsBeforeBuild(pHier, _
    itemid, docCookie)
int SaveDocumentsBeforeBuild(
    IVsHierarchy pHier,
    uint itemid,
    uint docCookie
)
int SaveDocumentsBeforeBuild(
    [InAttribute] IVsHierarchy^ pHier, 
    [InAttribute] unsigned int itemid, 
    [InAttribute] unsigned int docCookie
)
function SaveDocumentsBeforeBuild(
    pHier : IVsHierarchy, 
    itemid : uint, 
    docCookie : uint
) : int

Parameters

  • itemid
    Type: System.UInt32

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

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

Permissions

See Also

Reference

IVsSolutionBuildManager2 Interface

IVsSolutionBuildManager2 Members

Microsoft.VisualStudio.Shell.Interop Namespace