Template (Application Deployment Sample)
This topic describes how to use the Template sample for application deployment.
You can create and use two types of deployment scripts to customize BizTalk application deployment: pre-processing scripts and post-processing scripts. Pre-processing scripts are invoked before application installation and import begins and after uninstallation completes. Post-processing scripts are invoked after application installation and import completes and before uninstallation begins.
You can write pre- and post- processing scripts so that they are invoked for each of these operations. Alternatively, you can configure scripts to execute after only one of them. For more information about writing scripts, see Using Pre- and Post-processing Scripts to Customize Application Deployment.
This topic demonstrates how to write and deploy a script so that it is invoked before or after only one operation. You do this by writing a script that checks the values of three environment variables to determine the operation in the context of which it is being called. Based on this context, the script either continues or discontinues execution.
This topic describes how to take the following steps:
Set the log file location, so that you can generate a log file of the script operations.
Note
As a best practice, you should always generate a log file so that you can verify script operations and troubleshoot any problems.
Create a new BizTalk application and add the sample scripts to it.
Export an .msi file containing the application artifacts.
Delete the application from the BizTalk group, so that you can import the .msi file back into the same group as well as install it from the .msi file.
Import the application, and check the log file to see that the import operation was logged.
Install the application, and check the log file to see that the installation log was appended to the log file.
View the log files and note what operations the scripts performed and when they were performed.
What This Sample Does
Two .bat files provided for this sample contain the values of the environment variables for import, installation, and uninstallation. SamplePreProcessing.bat contains variables for a pre-processing script. SamplePostProcessing.bat contains variables for a post-processing script. The files also demonstrate how to log messages from scripts. You can copy the relevant sections of these files into your scripts.
Important
Some of the comments within the script files are incorrect, as follows:
In SamplePreProcessing.bat, the script comment, “Pre uninstall part of the script called for an existing application” should read "Post uninstall part of the script called for an existing application."
In SamplePostProcessing.bat, the script comment, “Post uninstall part of the script called for an existing application” should read "Pre uninstall part of the script called for an existing application."
Where to Find This Sample
The sample is located in the BizTalk Server installation folder, as follows:
<Samples Path>\Application Deployment\Template
As previously mentioned, the sample includes the following two files:
SamplePreProcessing.bat
SamplePostProcessing.bat
How to Use This Sample
To run the sample, take the following steps.
To set the logging location
Open both the script samples and change the LogFile variable to point to the location where the log files are to be written. You must provide the full path including the file name. If it includes spaces, you must enclose the path in double quotation marks (").
Example:
set LogFile="<Samples Path>\ApplicationDeployment\Templates\SampleLogOut.txt"
To create a new application
Click Start, click All Programs, click Microsoft BizTalk Server 20xx, and then click BizTalk Server Administration.
In the console tree, expand BizTalk Server Administration and expand the BizTalk group.
Right-click Applications and then click New.
In Application name, type
SamplesTemplate
, and then click OK.
To add the scripts to the application
Expand the folder of the SamplesTemplate application that you just created and right-click Resources in the left pane.
Point to Add and click Pre-processing Scripts.
Click Add and browse to SamplePreProcessing.bat.
Select the file and click Open.
In File type, click System.BizTalk:PreprocessingScript, and then click OK.
SamplePreProcessing.bat is added to the application and is displayed in the Resources folder of the application.
Right-click Resources again, point to Add, and then click Post-processing Scripts.
Click Add and browse to SamplePostProcessing.bat.
Select the file and click Open.
In File type, click System.BizTalk:PostprocessingScript, and then click OK.
SamplePostProcessing.bat is added to the application and is displayed in the Resources folder of the application.
To export an .msi file
In the BizTalk Server Administration console, right-click the SamplesTemplate application, point to Export, and then click MSI file.
On the Welcome to the Export Wizard page, click Next.
On the Select Resources page, click Next.
On the Specify IIS Hosts page, click Next.
On the Dependencies page, click Next.
On the Destination page, in Destination application name, type the application name.
In MSI file to generate, type the full path for the MSI file, and then click Export. Example: C:\MSI\SamplesTemplate.msi
On the Summary page, click Finish.
Delete the application
- In the BizTalk Server Administration console, right-click the SamplesTemplate application, and then click Delete.
To import the .msi file
In the BizTalk Server Administration console, right-click Applications, point to Import, and then click MSI file.
On the Welcome to the Import Wizard page, in MSI file to import, type the path of the .msi file that you previously exported, and then click Next. If necessary, you can browse for the MSI file by clicking the (….) button.
On the Application Settings page, in the Application name drop-down list, select the application name.
In Available applications to add references to, select the applications to which to add references, if any, and then click Next.
On the Application Target Environment Settings page, click Next.
Note
You do not need to specify a target environment for the purposes of this sample. For background information on this feature, see Binding Files and Application Deployment. For instructions on adding binding files, see How to Add a Binding File to an Application.
On the Import Summary page, confirm that the summary information is correct, and then click Import.
On the Results page, click Finish.
Open the log file that was created when the scripts executed, and verify that import operation was logged.
To install the application
Double-click the .msi file and run the Installation Wizard.
Open the log file and verify that installation operation was added to the logging information.
To verify that the scripts functioned correctly
- Open the log files and verify that they executed during the specified operations.
See Also
Application Deployment (BizTalk Server Samples Folder)
Deploying BizTalk Applications