共用方式為


IVsSolutionLoadManagerSupport.SetProjectLoadPriority Method

Sets the project load priority, which determines whether the project should be kept as an unloaded project the next time the solution is opened.

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

Syntax

'宣告
Function SetProjectLoadPriority ( _
    ByRef refguidProject As Guid, _
    loadState As UInteger _
) As Integer
'用途
Dim instance As IVsSolutionLoadManagerSupport
Dim refguidProject As Guid
Dim loadState As UInteger
Dim returnValue As Integer

returnValue = instance.SetProjectLoadPriority(refguidProject, _
    loadState)
int SetProjectLoadPriority(
    ref Guid refguidProject,
    uint loadState
)
int SetProjectLoadPriority(
    [InAttribute] Guid% refguidProject, 
    [InAttribute] unsigned int loadState
)
abstract SetProjectLoadPriority : 
        refguidProject:Guid byref * 
        loadState:uint32 -> int 
function SetProjectLoadPriority(
    refguidProject : Guid, 
    loadState : uint
) : int

Parameters

  • refguidProject
    Type: System.Guid%
    The GUID of the project

Return Value

Type: System.Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

There are four states for an unloaded project

  • PLP_DemandLoad: force the immediate load of the project during the Open Solution operation. If this value is set after the solution is opened, then this will force the load of the project on the very next idle point (or synchronously if IVsSolution4::EnsureXXXLoaded is also called).

  • PLP_BackgroundLoad: load in the background on idle.

  • PLP_LoadIfNeeded: load only if needed as a dependency of another loaded project, or if the user expands the project in the Solution Explorer.

  • PLP_ExplicitLoadOnly: keep unloaded even if needed as a dependency of another project. Explicit load only projects behave the same as projects unloaded by the user.

This project load priority setting is persisted during solution close in the .suo file (per-user, per-solution) and will be used as the load priority for the project on the next solution open, unless the Solution Load Manager overrides the persisted value by calling this method in OnBeforeOpenProject.

.NET Framework Security

See Also

Reference

IVsSolutionLoadManagerSupport Interface

IVsSolutionLoadManagerSupport Members

Microsoft.VisualStudio.Shell.Interop Namespace