BizTalk Map Comparisons with TFS

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.

  1. Create your initial map or make the necessary updates to your map as required.
  2. Prior to checking in your code, right-click the .btm file and choose Open with… from the menu selection.
  3. 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.
  4. 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.
  5. 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.

Enjoy

Nic

Leave a comment

BAM with BizTalk Deployment Framework

Deploying BAM Definition Using the Deployment Framework for BizTalk

Overview


I spent several hours looking for a Deployment Framework for BizTalk script example on how to deploy BAM definitions during build and deployment for one of my BizTalk solutions.  I stopped searching and decided to attempt the script writing myself.  After several trial and errors, I finally got a viable solution working for automatically deployment BAM definitions using the  Deployment Framework for BizTalk and MSBuild.

Environment 


I have a BizTalk 2009 environment with an installed BTDF version 5.0.16 installed on my development machine.  I used Microsoft Excel to create a BAM definition file with views and placed the xls file in logic folder under my Visual Studio 2008 solution.   I have already created a BAM definition file using Excel that will need to be added to the solution.

Solution


Step 1:  Open your <Solution>Deployment.btdfproj file and add the following lines:
 

Step 2:  Your final step is to tell the deployment framework where the BAM definition file is located relative to your project, along with the location path.  You may add several BAM definition files in the <BamDefinitions> tag. 

Note:  If updates are required to the definition files and a subsequent deployment is required, the BAM execution will always perform a bm.exe -update to all your BAM deployments as you have indicated in the <SkipBamUndeploy>true</SkipBamUndeploy> tag , so there is no risk data being lost in the BAMPrimaryImport database.

Leave a comment