Partilhar via


Make Comparing Build Process Templates Easier With XamlClean 1.0

Comparing XML is troublesome at the best of times but comparing Workflow Foundation XAML files is even harder because they contain both logic and designer markup. The designer markup stores information such as the expanded/collapsed state of each workflow activity, its size, and physical location on disk and has no effect on the resulting workflow but adds significant noise when comparing.

In this comparison you can see from the bar on the left that there are a significant number of changes between these two files but if you look at the circled lines on the right you’ll see that the only difference in these lines is the hint size:

image

If we remove all of the designer markup you’ll see that we get a much cleaner comparison that only shows the meaningful differences between the files:

image

So what can safely be removed? From my experimentation it appears that attributes and elements in the following namespaces can safely be removed from a Workflow Foundation XAML file:

Obviously doing this manually is time consuming and error prone so I’ve written a console application called XamlClean which can take a Workflow Foundation XAML file, remove the designer markup from it, and write it out to a new file. The usage is as follows:

XamlClean originalFile cleanFile

For example:

XamlClean DefaultTemplate.xaml DefaultTemplateClean.xaml

NOTE: XamlClean is provided “AS IS” with no warranties, and confer no rights. Backup your XAML files before overwriting them with the outputs from XamlClean to avoid data loss.

Comments

  • Anonymous
    January 24, 2011
    Hi William, We have been using XamlClean in our effort to migrate from using TFS 2008 build scripts with the upgrade template to native TFS 2010 workflow processes.  Your XamlClean application will be very useful to us, however, it doesn't remove all of the desinger code in the LabDefaultTemplate, as it doesn't employ the sap tags.  Could you either implement this functionality in your next iteration of the application, or make the source code available so that we can modify it for our needs?   Thanks, Chad S.

  • Anonymous
    January 26, 2011
    The comment has been removed