Partager via


IPersistXMLFragment Interface

Used to persist non-build related data in free-form XML.

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

Syntax

'Declaration
<InterfaceTypeAttribute()> _
<GuidAttribute("6B0C8632-6F01-4E54-9645-FFE82A2F4FE9")> _
Public Interface IPersistXMLFragment
[InterfaceTypeAttribute()]
[GuidAttribute("6B0C8632-6F01-4E54-9645-FFE82A2F4FE9")]
public interface IPersistXMLFragment
[InterfaceTypeAttribute()]
[GuidAttribute(L"6B0C8632-6F01-4E54-9645-FFE82A2F4FE9")]
public interface class IPersistXMLFragment
[<InterfaceTypeAttribute()>]
[<GuidAttribute("6B0C8632-6F01-4E54-9645-FFE82A2F4FE9")>]
type IPersistXMLFragment =  interface end
public interface IPersistXMLFragment

The IPersistXMLFragment type exposes the following members.

Methods

  Name Description
Public method InitNew Initializes the project extension properties and other build-independent data.
Public method IsFragmentDirty Determines whether an XML fragment has changed since it was last saved to its current file.
Public method Load The project opens and reads the XML fragment and the project subtype GUID from a specified file type.
Public method Save Base project system directs the project subtype to build the project subtype XML information and save it in the project or user file.

Top

Remarks

IPersistXMLFragment can be implemented on both the main project subtype aggregator object and the project subtype configuration objects. The base project calls the main project subtype aggregator object to load or save configuration independent data. The base project can also call on the project subtype configuration objects to load or save configuration dependent data.

Base project calls IPersistXMLFragment methods for each aggregation level by passing the GUID for each level. The base project then passes or receives the XML fragment dedicated for the particular project subtype. In a common case the project subtype implementation intercepts its own GUID after the base project passes it, and handles the call and forwards all other calls to inner project subtypes (with their particular GUIDs). The project subtype may also decide to modify the data it passes to the inner subtypes before or after the call to IPersistXMLFragment.

The base project maintains a collection of XML nodes attributed with the project subtype GUID and configuration type under the ProjectExtensions \ VisualStudio node in the Microsoft Build Engine (MSBuild) XML tree.

An example of XML data dedicated for a particular project subtype can be similar to the example scenario below.

<ProjectExtensions>

  <VisualStudio>

    <FlavorData= "GUID_Flavor">

      {Flavor debug data}

    </FlavorData>

  </VisualStudio>

</ProjectExtensions>

Notes to Implementers

Implement IPersistXMLFragment to enable the persistence of non-build related data in the project files by project subtypes.

See Also

Reference

Microsoft.VisualStudio.Shell.Interop Namespace