
With Workflow4, there is "some" information stored for the designer inside the XAML. This makes it quite hard to compare different versions of the same file. For example a different zoom factor already causes a lot of differences. What I’m trying to do is to set up my difference tool to ignore these differences and only show me the differences that matter.
An example of the troubles you get when comparing two XAML files:
Although I’m a big fan of WinMerge, I could not get this working with the built-in filter mechanism. It supports regular expressions for line filtering, but unfortunately this means that the whole line is ignored when it matches the expression. This means that when filtering on the designer information, these lines will completely be ignored even if there are other differences. Not exactly what I wanted…
- Tools» Options…
- File Windows » Rulesets » Add…
- On the Name tab
- Ruleset Name: Workflow4 (or whatever you want)
- File Suffixes: xaml
- On the Content Handling tab add a "context" for the designer information attributes:
- Add…
- Start Pattern: sap:VirtualizedContainerService.HintSize="
- End Pattern: "
- Ends at EOL: Unchecked
- Classify Differences as Important: Unchecked
- Add a "context" for the designer information elements:
- Add…
- Start Pattern: <sap:VirtualizedContainerService.HintSize>
- End Pattern: </sap:VirtualizedContainerService.HintSize>
- Ends at EOL: Unchecked
- Classify Differences as Important: Unchecked
It now only ignores the HintSize attributes and elements. Maybe it is safe to ignore all "sap" prefixed items. Hence they are marked as mc:Ignorable at the top of the XAML (where mc is the prefix for http://schemas.openxmlformats.org/markup-compatibility/2006). I’m not sure about that and the HintSize is the only one that has bothered me thus far.
As you can see the difference in HintSize is still shown in a different color, but it is not highlighted as the other change. These designer differences are also excluded on the location bar on the left. For me this makes comparing XAML files a lot easier!
See also James Manning’s blog about how to integrate the different diff/merge tools into the Visual Studio environment if you haven’t done that yet. You can also choose to use WinMerge as the default compare tool and DiffMerge only for XAML!
I hope you enjoyed this first blog.
Update:
Me and the team I’m on have used this solution for quite some time all working on the same build template (XAML). We haven’t experienced any problems using it. The only additional tweak I did is ignore *everything* in the sap-namespace and that seems to be ok too. The following pattern I used:
- Start Pattern: <sap:
- End Pattern: </sap:.*>