Oct 112007

I was recently asked to create a secure FTP adapter for BizTalk.

I created it and tested it. I then went to create the install package.

The issue is I needed to determine where BizTalk is installed and put the assemblies in that directory and write where I put those assemblies into the registry.

Here are the steps to make the MSI ‘smart’

  1. Open the Launch Conditions by right clicking on the Setup project View – Launch Conditions
    Launch Conditions
  2. Right click on the Search Target Machine folder and click Add Registry Search
    Registry Search
  3. In the properties, add the following values
    (Name) BizTalk Install Path
    RegKey SOFTWARE\Microsoft\BizTalk Server\3.0
    Root vsdrrHKLM
    Value InstallPath

    We are going to use this value BIZTALKINSTALLPATH thru the rest of the process

  4. Now we need to add the entries to the registry. We do this by right clicking on Setup project View – Registry (like step 1) and click Import
    Registry Import
    and import the registry file created from the Adapter Registry Wizard
  5. Now edit the locations that have the path hard coded
    Registry Modification
  6. Now we need to add the directory where BizTalk is installed for us to put the assemblies there, in File System (right click Setup – View File System), right click and Add Special Folder
    Custom Folder
    with the following properties
    (Name) BizTalk Folder
    Always Create False
    DefaultLocation [BIZTALKINSTALLPATH]\
    Property NEWPROPERTY1
    Transitive False
  7. In your BizTalk folder, add the assemblies you want to install
  8. Now we want the MSI to not only install the adapter, but also make sure that it is in the adapter list. We do this by executing the following VB script code, we want to make sure that the strAdapterMgmtCLSID in the script matches the entry in the registry and add it to the Application Folder.
    File System VBS
    'AddAdapter.vbs 'Adds adapter to BizTalk strAdapterName = "sFTP" strAdapterComment = "FTP using SSL" strAdapterMgmtCLSID = "{AC6145E9-44C2-4C3F-AC3A-D207C9E99B87}" AddAdapter strAdapterName, strAdapterComment, strAdapterMgmtCLSID Sub AddAdapter(strAdapterName, strAdapterComment, strAdapterMgmtCLSID) Set objLocator = CreateObject("WbemScripting.SWbemLocator") Set objService = objLocator.ConnectServer("localhost", "root/MicrosoftBizTalkServer") Set objAdapterClass = objService.Get("MSBTS_AdapterSetting") On Error Resume Next Set objAdapterInstance = objService.Get("MSBTS_AdapterSetting.Name='" & strAdapterName & "'") If (objAdapterInstance is Nothing) Then On Error Goto 0 Set objAdapterInstance = objAdapterClass.SpawnInstance_ Else On Error Goto 0 End If objAdapterInstance.Name = strAdapterName objAdapterInstance.Comment = strAdapterComment objAdapterInstance.MgmtCLSID = strAdapterMgmtCLSID On Error Resume Next objAdapterInstance.Put_(0) If (Err.Number <> 0) Then Else End If End Sub

  9. Now we simply need to add it as a custom action, we right click the project again View-Custom Actions, we want to make sure it is done after the registry is made, so lets put this in the Commit, right click and browse to the Application Folder and select OK.

    Add Custom Action

    It should look like this


You are ready to go!

    • Mike

      Hi Eric,

      Just wondering why you needed to install the adapters to the BizTalk installation folder. I wouldnt see this as a good idea. You can easily put them in your own folder as long as it matches whats in the registry. Also you can put them in the GAC and supposedly you dont need the path in the folder.

      Secondly you can do a custom installer in the adapters assembly which will let you have that WMI code in C# to add the adapter to save you having a vbscript file to look after.


    • You are right, putting it in the directory really doesn’t matter, but I did not know how to do it.
      I actually ended up putting everything in the GAC anyway and things ran fine.
      I posted this as an alternate to the approach you just suggested. I like to have a few options on the table of how I could do the same thing.

      Looks like people keep track my blogs more than I do!

    • This actually solves an issue where I need to run the BTSXrefImport.exe (which is installed in the BizTalk 2006 folder) when importing Xref data during an installation. This allows me to create an MSI to import the Xref data without having to hard code the location of the import utility and be able to determine where it is during install.

    • Choose – tour to 4 star Florence hotels, 4 star hotel in Rome, 5 star hotel Thailand.Adventure travel to Africa.Get air line ticket voucher now.

    • ll

      orted directly from deIsgner jewelry online sto

    • Looking forward for more such stuff.

    • e the location of the import utility and be able to determine where it is during install.