Friday, July 09, 2004

BizTalk 2004 Custom Functoids

The documentation wasn't as clear as it could have been, or I'm not as sharp today as I thought I was.  Took a little bit of wrangling, but I've been able to create my custom functoids for BTS2004.
Here are the steps that give consistent results:
1. Make sure the assembly has a unique Guid attribute
2. Derive a class from Microsoft.Biztalk.BaseFunctoid
3. Include appropriate resource infomration such as:
    base64 encoded Bitmap
4. Close the Visual Studio IDE if the current project uses the functoid.  It caches a global reference to the .dll and you can't update the file until its released
5. Copy the .dll to \Program Files\Microsoft Biztalk Server 2004\Developer Tools\Mapper Extensions to make it available for a developer workstation.
6. GAC the .dll in order to make it available during runtime, including map validation.
The biggest hurdle is getting your image embedded in the resource file (.resx), which requires some custom code:
    Image img = Image.FromFile("yourimage.bmp");
    ResXResourceWriter rsxw = new ResXResourceWriter("test.resx");
    rsxw.AddResource("test", img);
This code snippet will create a .resx file that includes the bitmap image data ("yourimage.bmp") encoded as base 64.  This can be copied and pasted into your functoid project.  Its also screaming for a little tool support, or automation.

Check out the sample available from the SDK at \Program Files\Microsoft BizTalk Server 2004\SDK\Samples\XmlTools\CustomFunctoid. You'll need to get the SDK Refresh for this to be available.


Zach Bonham | Technical Consultant *BAMPH* | 972.687.4851 office | 972.896.7405 cell |