共用方式為


SVsSolution Interface

Passed to GetService to return a reference to IVsSolution.

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

Syntax

'Declaration
<GuidAttribute("7F7CD0DB-91EF-49dc-9FA9-02D128515DD4")> _
<GuidAttribute("7F7CD0DB-91EF-49dc-9FA9-02D128515DD4")> _
<ComVisibleAttribute(False)> _
Public Interface SVsSolution
[GuidAttribute("7F7CD0DB-91EF-49dc-9FA9-02D128515DD4")]
[GuidAttribute("7F7CD0DB-91EF-49dc-9FA9-02D128515DD4")]
[ComVisibleAttribute(false)]
public interface SVsSolution
[GuidAttribute(L"7F7CD0DB-91EF-49dc-9FA9-02D128515DD4")]
[GuidAttribute(L"7F7CD0DB-91EF-49dc-9FA9-02D128515DD4")]
[ComVisibleAttribute(false)]
public interface class SVsSolution
[<GuidAttribute("7F7CD0DB-91EF-49dc-9FA9-02D128515DD4")>]
[<GuidAttribute("7F7CD0DB-91EF-49dc-9FA9-02D128515DD4")>]
[<ComVisibleAttribute(false)>]
type SVsSolution =  interface end
public interface SVsSolution

Remarks

The SVsSolution is accessible as a global service and is a single object which lives in the environment for the entire duration of the environment's lifetime:

A VSPackage can call QueryService for SID_SVsSolution before a solution is open.

If a solution is opened, closed and another solution open, is the SVsSolution service interface pointer remains constant. It is not necessary to unadvise for SolutionEvents when a Solution is closed. All event sinks are still maintained.

VSPackages can expect to cache a pointer to the SVsSolution service and the IVsSolution interface will remain valid until after each of the VSPackages call Close. VSPackages should unadvise for SolutionEvents when Close is called.

See Also

Reference

Microsoft.VisualStudio.Shell.Interop Namespace