共用方式為


IPersistXMLFragment Interface

Definition

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

public interface class IPersistXMLFragment
public interface class IPersistXMLFragment
__interface IPersistXMLFragment
[System.Runtime.InteropServices.Guid("6B0C8632-6F01-4E54-9645-FFE82A2F4FE9")]
[System.Runtime.InteropServices.InterfaceType(1)]
public interface IPersistXMLFragment
[<System.Runtime.InteropServices.Guid("6B0C8632-6F01-4E54-9645-FFE82A2F4FE9")>]
[<System.Runtime.InteropServices.InterfaceType(1)>]
type IPersistXMLFragment = interface
Public Interface IPersistXMLFragment
Attributes

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.

Methods

InitNew(Guid, UInt32)

Initializes the project extension properties and other build-independent data.

IsFragmentDirty(UInt32, Int32)

Determines whether an XML fragment has changed since it was last saved to its current file.

Load(Guid, UInt32, String)

The project opens and reads the XML fragment and the project subtype GUID from a specified file type.

Save(Guid, UInt32, String, Int32)

Base project system directs the project subtype to build the project subtype XML information and save it in the project or user file.

Applies to