One of the most frustrating aspects of working with BizTalk maps does not involve complex maps or functoid usage, or how to call external assemblies, but rather how to run a code compare against previously checked-in .btm files.
Often times I want to merely check what changes were made in in the map against a previously checked-in code in TFS. As some of you may have noticed, the .btm map file stores the code in a single line, so even if one byte of that code is different, the entire line is flagged as ‘changed’. Now it’s up to the developer to try to identify where that subtle change is from my example.
Although there is no easy answer, there is a work around that I’m about to illustrate that may help someone out without having to fiddle with extracting certain versions from TFS, then saving them to a .xml file, then rearranging the XML in pretty print. Rather just follow these extra steps when checking in your map code at the end of the day.
- Create your initial map or make the necessary updates to your map as required.
- Prior to checking in your code, right-click the .btm file and choose Open with… from the menu selection.
- In the pop-up window, select XML (Text) Editor and click Ok. Visual Studio will prompt you if you want to close the existing mapping document. hopefully you saved your work. go ahead and say Yes.
- A new window with the map code will appear. Reformat the code by performing the following keyboard short-cut to make the XML nicely formatted. Click on the Ctrl key and while holding the key, click on the K key then D key. That should reformat your .btm file nicely into multi-line code. Remember Ctrl-K-D works in any .xml file in Visual Studio.
- Save and check the .btm file into TFS.
Note that you cannot compare any previously checked-in maps in TFS, but at least going forward, you can run comparison against this and any subsequent map files in TFS. This is why I advocate that whoever creates the initial map, to perform the xml reformat using the steps above before checking the code in.
Hope this blog helped someone out.