How to fix or configure the Deployment Properties of a BizTalk Project with PowerShell

It is nothing new that before you can deploy a solution from Visual Studio into a BizTalk application, you must first set project properties, especially the Server and the Configuration Database. Otherwise, two things may happen:

  • The deployment will fail when you try to deploy it through Microsoft Visual Studio or will you are redeploying a previously deployed BizTalk project.
  • The assemblies and all their artifacts will be deployed to and unwanted BizTalk Application (normally BizTalk Application 1)

If a solution in Visual Studio contains multiple projects, you must separately configure properties for each project.

To configure project properties you normally need to:

  • In Visual Studio Solution Explorer, right-click a project for which you want to configure properties, and then click Properties.
  • Click the Deployment tab in Project Designer.
  • Configure the following project properties
    • Application Name: Name of the BizTalk application to which to deploy the assemblies in this project. If the application already exists, the assemblies will be added to it when you deploy the project. If the application does not exist, the application will be created. If this field is blank, the assemblies will be deployed to the default BizTalk application in the current group. Names that include spaces must be enclosed in double quotation marks (“).
    • Configuration Database: Name of the BizTalk Management database for the group, BizTalkMgmtDb by default.
    • Server: Name of the SQL Server instance that hosts the BizTalk Management database on the local computer. In a single-computer installation, this is usually the name of the local computer.
    • Redeploy: Setting this to True (the default) enables you to redeploy the BizTalk assemblies without changing the version number.
    • Install to Global Assembly Cache: Setting this to True (the default) installs the assemblies to the Global Assembly Cache (GAC) on the local computer when you install the application. Set this to False only if you plan to use other tools for this installation, such as gacutil.
    • Restart Host Instances: Setting this to True automatically restarts all host instances running on the local computer when the assembly is redeployed. If set to False (the default), you must manually restart the host instances when you redeploy an assembly.
    • Enable Unit Testing: Specifies whether to enable unit testing for the project.
  • And then click OK.
  • Repeat steps 1, 2, and 3 for each project in the solution.
Deployment Properties BizTalk Project Visual Studio

This seems a slight and easy task but now imagine that you have almost 200 projects inside a unique Visual Studio Solution! It will be an insane operation and most likely to happen is that you will fall asleep in front of the PC.

With this PowerShell, you will be able to parameterize all projects inside a Visual Studio Solution running a single line of code and avoid spending numerous hours doing this task manually.

 $allPropertyGroup = $xml.Project.PropertyGroup 
     foreach($node in $allPropertyGroup) 
     { 
         if($node.Server -ne $null) 
         { 
             $node.Server= ""; 
             $node.ConfigurationDatabase= "BizTalkMgmtDb"; 
             $node.ApplicationName= ""; 
             $node.Redeploy= "False"; 
             $node.Register= "True"; 
             $node.RestartHostInstances= "False"; 
         } 
     }
 

Download

THIS POWERSHELL IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND.

You can download Visual Studio: Fixing BizTalk Project Deployment Properties with PowerShell from GitHub here:

Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc. He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community.

1 thought on “How to fix or configure the Deployment Properties of a BizTalk Project with PowerShell”

  1. Hi,

    I have similar requirement but I am unable to download you script. I wanted to configure all the deployment configuration via script (like.. .snk, Application name, assembly name, database everything which is needed for BizTalk application deployment.) Appreciate your help here

Leave a Reply

Your email address will not be published. Required fields are marked *

turbo360

Back to Top