Partager via


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

'Declaration
Function SaveDocumentsBeforeBuild ( _
    pHier As IVsHierarchy, _
    itemid As UInteger, _
    docCookie As UInteger _
) As Integer
int SaveDocumentsBeforeBuild(
    IVsHierarchy pHier,
    uint itemid,
    uint docCookie
)
int SaveDocumentsBeforeBuild(
    [InAttribute] IVsHierarchy^ pHier, 
    [InAttribute] unsigned int itemid, 
    [InAttribute] unsigned int docCookie
)
abstract SaveDocumentsBeforeBuild : 
        pHier:IVsHierarchy * 
        itemid:uint32 * 
        docCookie:uint32 -> int
function SaveDocumentsBeforeBuild(
    pHier : IVsHierarchy, 
    itemid : uint, 
    docCookie : uint
) : int

Parameters

  • itemid
    Type: UInt32

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

  • docCookie
    Type: UInt32

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

Return Value

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

.NET Framework Security

See Also

Reference

IVsSolutionBuildManager2 Interface

Microsoft.VisualStudio.Shell.Interop Namespace