My blog has moved!

You should be automatically redirected in 6 seconds. If not, visit
http://www.f5todebug.wordpress.com
and update your bookmarks.

Tuesday, 4 March 2008

Calling an External Assemby from a Scripting Functoid


Having completed the official Microsoft course on developing with BizTalk (credit to QA-IQ for adding some great additional content to the course), I have been working on some projects in anger.

The most recent issue I had was around testing a map which used a scripting functoid to call my data layer to get some data out of a database.

I built a class library project which provides various methods to retrieve the data I need using the data layer. However when I referenced the project in my maps project (note that I keep all BizTalk file types e.g. schemas, orchestrations, maps etc in their own project for ease of deployment) I got an error essentially saying that the assembly could not be loaded. After some rooting around I found the problems.

The following is my checklist for things to look for if you are having problems with this:

  • Make sure that all functions used on your assembly are working correctly first. Its much easier to know that you can rule out problems with your referenced code prior to using it in BizTalk.

  • DO NOT set-up shared (static in C#) functions on your referenced assembly if you want to call them from a scripting functoid. BizTalk will natively try to instantiate your class so these will not work.

  • Restart VS to ensure that all references have been freshly loaded.

  • Ensure that the dll for your referenced project is installed in the GAC on your development machine.

  • If you are using the 'Test Map' functionality from within VS then you will also need to ensure that any config settings that are required for your assembly (e.g AppSettings) are included in the devenv.exe.config file. At runtime these settings will need to be put into btsntsvc.config on your live configuration.

  • If you have updated your assembly then ensure that VS is trying to use the correct version, remove all references to your assembly and add them again.

  • Refresh the GAC.

  • If you wish to debug your referenced assembly then you will have to setup a test project to do this, however ensure that you un-install your dll from the GAC if you have already installed it as VS will try to use the GAC version first and this will not have a debug file associated with it. You will get an error saying that no debug information has been generated if VS is using the reference from the GAC.

I hope that this has been helpful. I suspect I will be adding a few more BizTalk related posts as I get to grips with some of the finer points of the technology.

No comments:

Post a Comment

Please leave a comment if you have found this post useful, or if there are any errors. I will do my best to assist if a posted solution does not help with your problem.