SelectiveBindingImport (Application Deployment Sample)
This topic explains how to use the SelectiveBindingImport sample. You can use this sample script to apply different bindings to an application when you import the application into different destination environments. You can use this approach when you want to import the bindings from binding files that are stored on a network share.
Note
If you do not need to automatically import binding files from a network share during application import, you can add to the application different binding files that have different destination environments specified. When you import the application, you can specify the environment, and the bindings for that environment will be applied automatically. For more information, see Binding Files and Application Deployment.
BizTalk applications are typically moved from development to testing to staging and then to production environments. The bindings used in different environments are typically different. Using this sample, you can apply bindings for different environments as follows:
Placing all the binding files that you want to use on a network share.
Adding a post-processing script to the application that will import from this location the correct binding file for the particular destination environment during application import. The script detects the environment by reading an environment variable named %ENVIRONMENT% that you set on the local computer,
What This Sample Does
This sample illustrates how to selectively import binding files from a network share by using a post-processing script contained in a BizTalk application .msi file.
Where to Find This Sample
You can find the following sample folders and files under <Samples Path>\Application Deployment\SelectiveBindingImport:
Develop (Folder)
- Dev.xml
Production (Folder)
- Production.xml
Staging (Folder)
- Staging.xml
Test (Folder)
- Test.xml
SelectiveBindings.bat
How to Use This Sample
Use the following procedures to run this sample.
To run the sample
Run Build.Bat from the <Samples Path>\Application Deployment\CreateApp directory. This creates the following files in the <Samples Path>\Application Deployment\CreateApp\Dlls folder: Schemas.dll, Maps.dll, and Orchestrations.dll.
Create the application. In the BizTalk Server Administration console, create an application, as described in How to Create an Application.
Add to the application the .dll files created in the first step. For instructions, see How to Add a BizTalk Assembly to an Application.
Create the ENVIRONMENT variable, as follows:
On the Start menu, right-click My Computer and click Properties.
On the Advanced tab, click Environment Variables.
In the User variables section, click New.
In Variable name, type ENVIRONMENT.
In Variable value, type on of the following values for the environment: Develop, Production, Staging, or Test. These values are case sensitive.
Click OK three times.
Copy the binding files to a location on your file system. Copy the binding .xml files from the Develop, Test, Staging, and Production folders to a location on your file system.
Edit the post-processing script. Edit SelectiveBindings.bat as follows:
Specify the binding file location. In the line containing BINDINGS_LOC, delete REM, and provide the path to the location where you copied the binding files.
Example:
BINDINGS_LOC=C:\MyBindings
Specify the application name. In the line containing APPLICATION_NAME, delete REM, and provide the name of the application into which you want to import the bindings.
Example:
APPLICATION_Name=SelectiveBindingImport
Add the script to the application as a post-processing script. For instructions, see How to Add a Pre- or Post-processing Script to an Application.
Export the application. For instructions, see How to Export a BizTalk Application.
Delete the application. For instructions, see How to Delete a BizTalk Application from the BizTalk Group.
Import the application. For instructions, see How to Import a BizTalk Application. You do not need to specify a destination environment.
Verify that the right binding file was applied. You can do this by checking the description field of the receive locations, as follows:
Click Start, click All Programs, click Microsoft BizTalk Server 20xx, and then click BizTalk Server Administration.
In the console tree, expand the BizTalk group, the BizTalk application, and the Receive Locations folder.
In the right pane, view the description of the receive locations.
Install the application. For instructions, see How to Install a BizTalk Application.
See Also
Application Deployment (BizTalk Server Samples Folder)
Deploying BizTalk Applications