On of the fundemental part of working with BizTalk is understanding how BizTalk uses the assemblies you build in VS.NET. The process of development is to create a VS.NET BizTalk project and then add BizTalk artifacts (schemas, maps, orhestration, and pipelines) and then Deploy them into the BizTalk managment database so that the BizTalk runtime can know about the artifcats you want to use, and be able to load them at runtime. In order to load them at runtime, these assemblies all have to be deployed into the Global Assembly Cache (GAC).
When you deploy a BizTalk assembly, the deployment tool uses Reflection to determine what artifacts are in the assembly and then adds the appropriate entries into the management database tables. One of the more frustrating things working with BizTalk can be knowing when you have to undeploy an already deployed assembly. Undeploying and redeploying can be a difficult experience. I won’t even both to enumerate all the things that can happen when you do that, but I think anyone who has worked much with BizTalk has had a “undeploy experience” :).
One thing you can do to avoid having to go through the undeploy/deploy/rebind/reconfigure is do what I call the three-Rs of BizTalk development – Re-build, Re-gac, and Re-start. Whenever you make a change to an artifact in your BizTalk assembly, you always have to Re-build. If you want BizTalk to pick up this change the next time you run the artifact (let’s say you want an orhestration change to execute the next time you send a message into your BizTalk application) – you MUST Re-start the BizTalk host process. If you don’t – even if you undeploy and deploy your assembly, the BizTalk host will still have cached in memory the assembly it loaded the last time it Re-started. This caching is what is supposed to happen in the CLR for efficiency reasons.
One thing to learn then is when do you have to undeploy and deploy and artifact again, and when can you just Re-start the host. Remember you always have to Re-build and you always have to Re-gac. Figuring out the changes that can just leave you with Re-build,Re-gac, and Re-start steps versus having to undeploy and deploy again will save you an enormous amount of development time.
I’ve created this table to help people figure out – what changes require me to Undeploy and Deploye (the UD column on the table) and which changes allow you to just Re-gac and Re-start (the GR on the table). So the key for this table is U==Undeploy, D==Deploy,Gac==put the assembly in the GAC, and R==Restart the BizTalk host.
Remember – you always have to do the GR step. The question you can ask yourself when you make a change is – can I avoid having to UD (Undeploy and deploy). If anyone has any addition comments let me know please – or if you see something that isn’t correct – please leave a comment on this post.