This project has moved and is read-only. For the latest updates, please go here.

Creating new HOSTS and HostInstances

Topics: General Questions
Dec 1, 2010 at 5:04 PM
Edited Dec 2, 2010 at 6:08 AM

Hi Thomas,

First let me cogratulate you for BTDF.

I would like to create a BizTalk Host (mentioned in the btdfproj) in case it is already not present.

Would it be possible in the latest release ?

If not, then could you please guide in simple steps to run a preprocessing script (typically a .bat or a .exe file) that would do the job of creating the Hosts and Hostinstances and their respective mappings etc in my case  via btdfproj.

I am using BizTalk 2010.


Avinandan Patra

Dec 1, 2010 at 7:33 PM

Thanks Avinandan!  There is nothing built in to create or modify hosts or host instances.  However, you can script the configuration using WMI through VBScript, C#, PowerShell or your preference.  Here are the samples for VBScript and C#:

Once you have a working script, you can call it from your deployment inside a Target named CustomDeployTarget in your .btdfproj (see other posts here about CustomDeployTarget).  Or, you can simply call your script separately from the deployment.  I have never tried changing the list of hosts during execution of a deployment script, so I'm not sure if CustomDeployTarget will be called early enough to avoid errors.


Dec 2, 2010 at 2:39 PM

Thanks for the quick reply Tom.

I have read various posts regarding CustomDeployTarget.

Could you please provide the various commands/Tasks (with sample code or syntax) that could be used here.
So far I have got the below two commands.

1. Exec Command
    <Target Name="CustomDeployTarget">
        <Exec Command="regedit /S somefile.reg"></Exec>

2. Copy Command
    <Target Name="CustomDeployTarget">
        <Copy SourceFiles="ABC_Folder\xyz.xml" DestinationFolder="DEF_Folder" ></Copy>

I haven't tried the CustomDeployTarget yet, I am currently creating a exe file calling the relevant WMI methods to create the hosts.
I just need the correct command that could invoke this exe file.


Thanks in advance.
Avinandan Patra



Dec 2, 2010 at 4:34 PM

If you just need to call your .EXE from the CustomDeployTarget target, then you'll use an Exec task like #1.  Here's the documentation for the built in tasks in MSBuild 4.0:

Your EXE path reference in the Exec task should be relative to the Deployment project folder.  If you put the EXE in <solutionroot>\Helpers, the path would be ..\Helpers\Your.exe.  Remember to include your helper EXE in the MSI by adding an ItemGroup with the AdditionalFiles element.