IPersistXMLFragment IPersistXMLFragment IPersistXMLFragment Interface


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

public interface IPersistXMLFragment
type IPersistXMLFragment = interface
Public Interface IPersistXMLFragment


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.



<FlavorData= "GUID_Flavor">

{Flavor debug data}




Notes to Implementers

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


InitNew(Guid, UInt32) InitNew(Guid, UInt32) InitNew(Guid, UInt32)

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

IsFragmentDirty(UInt32, Int32) IsFragmentDirty(UInt32, Int32) IsFragmentDirty(UInt32, Int32)

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

Load(Guid, UInt32, String) Load(Guid, UInt32, String) 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) Save(Guid, UInt32, String, Int32) 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