Category name:Software Factory

BizTalk Software Factory v5 for BizTalk 2013R2

If you’re not familiar with the BizTalk Software Factory, please read the documentation on

Every new release of BizTalk requires some changes in the BizTalk Software Factory (BSF) and the 2013R2 edition is no exception. Most important change is in the Visual Studio version and the BSF relies on the Guidance Automation Toolkit (GAT) and Extensions (GAX) to be available.

Since Microsoft stopped development of the toolkit and extensions I’m happy to see the community continues it by means of the Open GAT/GAX ( project.

To be able to install the BSF ( you need to install the Visual Studio 2013 SDK and the Open GAT/GAX for Visual Studio 2013 upfront.

The functionality of the BSF hasn’t changed but it is important to know that at this moment there is no version of the BizTalk Deployment Framework (BTDF) that supports Visual Studio 2013. Since the BSF supports the BTDF, it currently is available but doesn’t work. Installing BTDF v5.5 on Visual Studio 2013 does work, but Visual Studio will not contain any of the BTDF functionality.

If you run into issues or you like to have some additional functionality in the BSF please let me know.

Didago IT Consultancy

Interesting rendez-vous with NDepend

This story starts in December 2008, but I found out only last June…..

Back in 2008 Patrick Smacchia of NDepend contacted me via my blog to ask me if I was interested in testing NDepend, but unfortunately I wasn’t notified of his message. Almost 4 years later (!) I came by accident across his message and decided to contact him and the request still stood Smile.

I already knew NDepend from early releases. Back then I ran into the famous “File or assembly name or one of its dependencies not found” exception and it was sometimes a challenge to find out which dependency was missing. Moreover because the dependencies also might have missing dependencies themselves, and so on. A first look at current NDepend made me happy because I saw the tool has evolved tremendously.

One of the reasons I started developing the BizTalk Software Factory is the fact that I think developers should be assisted in their work to build consistent, reliable and maintainable software. While looking at the features of NDepend I got enthusiastic about that part of the capabilities of NDepend.

This blog post is a review of some of the capabilities of NDepend. It is capable of much much more, so I’d like to refer to the website for additional information, documentation and instruction videos.

So of the list of features of NDepend, I like to focus on Code Quality, Code Query, Code Metrics, Explore Architecture, Detecting Dependency Cycles and Complexity and Diagrams.

If you’re involved in BizTalk development you probably know that tools like FxCop (now called Visual Studio Code Analysis) and things like Visual Studio Code Coverage are almost meaningless because most of the code is generated. But this doesn’t count for custom components like libraries, helper components, custom pipelines, custom functoids etc. It still is valuable to have tools checking the quality of your code and detect unwanted dependencies. But of course, the more custom written code you have, the more valuable tools become.

So lets start with some of the features that I like most from a code quality perspective. For this blog I use NDepend v4.0.2 Professional which I installed as Add-in for Visual Studio 2010. For my website I used the open source Orchard CMS and I took that code to do some testing.

In Visual Studio a new NDepend menu option shows up. With the option “Attach a new NDepend Project to VS Solution” you can add NDepend analysis to a project and it starts analyzing right away (if you leave the checkbox checked).

In the lower right corner of the Visual Studio a circle shaped indicator is visible after installing NDepend and after analyzing Orchard CMS the indicator is red. The results of the analysis are in the image below. Also clicking on the indicator displays the “Queries and Rules Explorer” which shows what rules actually are violated. This is a nice an quick overview of the violations.


In this example the “Methods too complex” violation is clicked, resulting in displaying the details in the “Queries and Rules Edit” dialog. By hovering over mehod “indexPOST”, a small dialog will be added on the right side of the explorer with details about the file and code metrics. Double clicking “indexPOST” will take you directly to the actual code. It is so easy to navigate to problem locations with this.

Because there are so many rules checked, it is also valuable to just take a look at the violations to learn from best practices. Besides the build-in rules, also custom queries over code are possible. All queries use LINQ style called CQLinq to retrieve information. All code metrics are written using the LINQ queries so it is easy to add your own (or take advantage of queries written by others).


Before NDepend I would have no idea how to find out the number of method in my code with more than 6 parameters, more than 10 declared variables or more than 50 lines of code. Or a combination of that. With this LINQ syntax it is a piece of cake.

For example a query to find all methods where the number of variables > 40(!) and are public.

from m in Methods where m.NbVariables > 40 && m.IsPublic select m
It is amazing to see what’s possible by just trying, assisted by intellisense!
Another really (and I mean really really) awsome feature is the Metric View, which is a visual representation of the code by module and size.

The size of every rectangle indicates the size of the method.

A second view uses LINQ queries again to visualize in this case the top 50 methods by number of lines of code. By visualizing this in the Metric View it becomes immediately clear where problems are located. Of course other metrics can be made visible in this way.

I’d like to end with another nice feature, the dependency graph and dependency matrix. The matrix shows an overview of the dependencies modules have on each other. Not only the dependencies between project components, but also dependencies on .NET system libraries are shown, which gives you insight into what assemblies actually are used in your project.

This view definitely will give you a better understanding of your code and might raise an eye brow if you find out you’re depending on an assembly that you’re not supposed to depend on. Especially if you’re responsible for a clean architecture in a large development team you need to verify the code doesn’t violate your architecture.

This tool is so comprehensive that I couldn’t possibly cover all features, but I’ve touched the ones that I’m most interested in. I’m really impressed by NDepend and I’m sure I’ll use it in upcoming projects. Being able to query the quality of your code is just awesome!


Didago IT Consultancy

BizTalk Software Factory for BizTalk 2010 Released

It took a while but now I can proudly announce the release of v3.0 of the BizTalk Software Factory!

This version supports:

Opposed to the BSF versions for BizTalk 2006 and BizTalk 2009, this release no longer supports the creations of custom pipeline components. It would have meant quite some work and wouldn’t add much value. To create a custom pipeline component, I would recommend using the Pipeline Component Wizard on Codeplex.

Things are quite different in Visual Studio 2010 regarding the creation of guidance packages, but installation is much simpler now. You can just use the extension manager to add the prerequisites and the actual BSF package.

If you’re looking for guidance on installation and usage, I would advise you to use the documentation that accompanies this release.

The bits are on Codeplex.

Please let me know what you think of it!

Didago IT Consultancy

New release of BizTalk Deployment Framework

The guys from the well known BizTalk Deployment Framework have been working very hard lately. Last year there was a version 5.0 beta for BizTalk 2009 solutions and BizTalk 2006 developers had to use version 4.0.

A few days ago they released a new beta of version 5.0 which supports not only BizTalk Server 2009 but also BizTalk Server 2006 and 2006 R2! I’m very happy with these great improvements because v4.0 was much more complex than the beta of v5.0 last year and now they even improved the v5.0 of last year.

I definitely need to dive into this, because the BizTalk Software Factory relies on the BDF for deployment. I already started to fix some x64 issues and now I can integrate the latest version of the BDF as well.

Setting the icon in a guidance recipe

Yesterday I co-presented at the Dutch BizTalk User Group. It was a talk about the BizTalk Software Factory and I did the demo. Afterwards I got the question on how to set the icon on a guidance recipe, like in the picture below.


I had to look it up in the code but I found it. By blogging it now it is also a note to self.

In the recipe you specify the arguments, actions and also the icon for the recipe. Below is a piece from the recipe for adding a map unit test from the BizTalk Software Factory. The HostData section specifies the icon and where the recipe should show up.


Next issue is what icon to take and what does the 133 mean? There is not much documentation about that on, for example, how to add your own icon. So I decided to use an existing one. Which one to take? To find out the ID of the icons, I used this tool: FaceID browser

It is a tool to get the ID’s of the Office icons and since Excel is installed on basically every BizTalk installation it does work well.

My fight with T4 Templates for BSF

At the moment I’m working on integrating the great Pipeline Component Wizard by Martijn Hoogendoorn into the BizTalk Software Factory. I decided to use a T4 template to get the job done. T4 templates are very powerful and easy to write (but hard to debug, as I found out). This post is dedicated to what I ran into while developing the templates.

The issues I had to deal with were:

  • Changing the wizard into a custom wizard
  • Getting the data out of the wizard into the T4 template
  • Processing the data in the T4 template to get the right code generated
  • Debugging T4 templates
  • Figuring out why I ran into the error “The given key was not present in the dictionary”


First of all, the current implementation of the PLCW wasn’t functioning on systems with GAT installed. That was the basic reason to change the wizard. The PLCW is based on the Microsoft.BizTalk.Wizard framework. The custom wizard pages in the guidance inherit from the Microsoft.Practices.WizardFramework.CustomWizardPage class and the wizard of the PCLW couldn’t be used 1-on-1. One of the reasons for that is that it is important for the CustomWizard page to have the following constructor:

public MyCustomWizardPage(WizardForm parent) : base(parent)
   // This call is required by the Windows Form Designer.

Among other things like the way the wizard saves state between pages, I decided to reuse the pages but inherit them from the CustomWizardPage.

The wizard collects some data to use in the pipeline component creation process and everybody who is familiar with the PLCW knows you can define custom design properties at the end of the wizard. I thought it was a good idea to create a small class for that to contain the type/name values and put that into a generic list for ease of use.

For every variable you want the wizard save between pages and have available at the end, you should define an argument in your recipe. So I defined like this:

<Argument Name="ClassName" Type="System.String" />
<Argument Name="DesignPropertyList" Type="System.Collections.Generic.List<MyDesignProperty>" />

Everybody with a bit of XML knowledge understands that this isn’t going to work, so I looked at some samples and changed it into this:

<Argument Name="DesignPropertyList" Type="System.Collections.Generic.List&lt;MyDesignProperty&gt;" />

In the code of the custom wizard pages, you can write and read the arguments like this. Make sure the name used in ‘SetValue’ is exactly the same as the argument.

IDictionaryService dictionaryService = GetService(typeof(IDictionaryService)) as IDictionaryService;
dictionaryService.SetValue("ClassName", txtClassName.Text);

  • Make sure every argument has a value otherwise you will end up with error messages saying the specific argument is empty.

So now I have defined the necessary arguments and created the custom wizard pages and now I want to use the arguments in a T4 template action. For that I need in fact 2 actions:

  • Generate the content with Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TextTemplateAction
  • Write the content to file with Microsoft.Practices.RecipeFramework.Library.Actions.AddItemFromStringAction

I defined the arguments as properties in the T4 template, but it didn’t work. I didn’t receive the generic list with design property values as I saved into the arguments in the wizard. After a long search I found that a generic class isn’t supported by this action. How to solve this? I downloaded the Smart Client Software Factory and the Web Services Software Factory to peek at their solution (they are quite good at this, I can tell you that). There appeared to be a simple solution for this like defining an empty new ‘collection’ class like this:

public class MyDesignPropertyCollection : List<MyDesignProperty>

So I had to change the argument again into:

 <Argument Name="DesignPropertyList" Type="BizTalkSoftwareFactory.BusinessEntities.MyDesignPropertyCollection, BizTalkSoftwareFactory" />

In the T4 template the value should be specified as this:

<#@ Assembly Name="BizTalkSoftwareFactory.dll" #>
<#@ Import Namespace="BizTalkSoftwareFactory.BusinessEntities" #>
<#@ property processor="PropertyProcessor" name="DesignPropertyList" #>

One of the other issues is that I was uncertain what I received in the T4 template. Debugging T4 templates can be hard although there seems to be tools available. I used a custom debug class to be able to view the available values in the template. I defined a method which I call in the beginning of the template:

<#  TemplateHelper.DebugThis(this); #>

Of course you need to import the namespace where the method can be found:

 <#@ Import Namespace="BizTalkSoftwareFactory.BusinessComponents" #>

So I now have generated content which I need to write to file, that is what the second action is for. It takes the output of the previous action, location to add the file to and name of the file. That doesn’t look too difficult as I used it already in the Unit test part. So I copied that part of the recipe and then I ran into the error “The given key was not present in the dictionary” and I really didn’t understand where it came from. I compared the code and it looked the same. At these times it can be very frustrating not to be able to debug, as I found out I didn’t even get into the second action. I grabbed the code using reflector and created my custom action with that code, but the error showed up even before entering the action.

Now what?

Literally hours later I found what caused the action and of course afterwards it is always easy.

I defined the action like this:

 <Action Name="AddPipelineComponent" Type="Microsoft.Practices.RecipeFramework.Library.Actions.AddItemFromStringAction, Microsoft.Practices.RecipeFramework.Library" Open="true" >
  <Input Name="Content" ActionOutput="GeneratePipelineComponent.Content" />
  <Input Name="TargetFileName" RecipeArgument="PipelineComponentFileName" />
  <Input Name="Project" ActionOutput="PipelineComponentProject" />

The problem is in the “ActionOutput” for input “Project”. Logically “ActionOutput” means……..output of an action and that wasn’t the case. It was a regular “RecipeArgument”. Very easy to fix, but hard to find.

So if you run into the error “The given key was not present in the dictionary”, think about this it will save you hours. J

If you need guidance with generic lists and wizards/actions I would advise you to look at the Smart client software factory and the Web service Software Factory.

  • Recent Posts
  • Recent Comments
  • Archives
  • Categories
  • Meta