Skip to main content

Write ChangeSet Data to XML File

If you want to write the changeset data (compare results) from a Data Sync project to a file when a project is run from the Run Tool or via Task Scheduler you can use Project automation and the code below to do so:

    public override void AfterCompare(ProjectAutomationCompareResult compareResult)
{
if(compareResult.HasChanges && !IsInteractive)
{
var instanceID = Properties["Auto_InstanceID"] ?? "0";
compareResult.GetChangeSetSerializer().WriteXml($"./.ds/logs/{instanceID}-ChangeSet.xml");
}
}

This writes the changeset data to an XML file in the DS logs folder and pulls the instance ID from the Run Tool into the file name.

If it is run from the Data Sync designer it will not write the change set to the file (as you can see the results in Data Sync) but if it is running from the Run Tool then it will create the file and write the results.