Ok, sorry for the short hiatus….very busy times on my current project.  Anyway, I previously mentioned some points around deployment.  It turns out that using BTS Installer doesn’t work well when utilizing roles and parties.  This doesn’t mean we have to scrap the BTSInstaller all together, we just have to do a little extra work in creating scripts that do the deployment as well as the undeployment, and then call those scripts from our MSI package.


 


In the zip file (get it here), I’ve included some sample scripts that may give you a head start in the deployment process.  Keep in mind that if you are NOT using roles and parties, BTSInstaller will get you about 80% of the way there, and you will not need all of the scripts.  You will still need some scripts to go ahead and enlist and start everything, and some work is needed to automagically undeploy everything using Add or Remove Programs.  With everything included in the zip file, you should be able to gleam something that will help.


 


A few key points –


 



  • Binding files – everything is driven by the binding file.  Make sure it is correct, or you will have issues.  One thing to watch out for is your binding file contains the PublicTokenKey of the assembly it is derived from.  If during multi-developer development these somehow get out of sync, when you deploy you won’t get any errors, but nothing gets deployed either.

  • Deleting parties – if you are implementing parties and roles, you will have to un-enlist the parties and delete them prior to un-deploying the assemblies that contain the orchestrations.  Included in the SDK are 2 sample projects that when compiled create one exe to un-enlist the parties, and one exe to delete the parties.  These are coded assuming that the SQL database where your management database resides is local to BizTalk.  This is most likely not the case, so you will have to edit this code to determine what server the database is on, and supply that in the connection string.  It’s quite simple using MSI, and if you need some code snippets just send me a comment.

  • Removing orchestrations – running the MSI to delete orchestrations (if using the default BTSInstaller) won’t remove your Orchestrations since they are in the running state.  Chances are if you’re testing they are even in the active state.  In the supplied StopOrchestrations script, there is a flag you can pass into the Unenlist method that will terminate any active instances.  Pay attention to this if this is not your intended actions.

  • Write to the event log – you will notice in my scripts I have added some code to shell out and use the LogEvent method to write errors to the Application Log.  With the nature of VBScript, if you don’t do this and run into errors, you will never figure out where to start looking.

 


Use the scripts at your own risk.  They are commented, so you should be able to read along and see what’s going on.  Remember, if you are not using roles, you won’t need half the stuff in the Install.bat file, and some of the stuff in Cleanup.bat, but read through those to see the order things are called, and you will need some of the other scripts regardless.


 


Cheers!!