Today I’m going to speak about another critical Best practice, Tips and Tricks for BizTalk Server developers: How to easily configure Visual Studio BizTalk Server Deployment properties.
Visual Studio BizTalk Server Deployment properties
It’s nothing new – especially for BizTalk developers with experience – that before you can deploy a solution from Visual Studio into a BizTalk application, you must first set project properties. Otherwise, two things may happen:
The deployment will fail when you try to deploy it through Microsoft Visual Studio.
The assemblies, and all their artifacts, will be deployed to an unwanted BizTalk Application (typically BizTalk Application 1)
So, if that is so basic, why I’m addressing this?
Indeed it is one of the BizTalk developer’s most basic tasks if you want to deploy the solution from Visual Studio – and this happens almost every time we are doing a solution or changing a solution in the development environment. But you need to be aware, and this is important: If a solution in Visual Studio contains multiple projects, you must separately configure the 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 the 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 local computer’s name.
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 redeploying an assembly.
Enable Unit Testing: Specifies whether to enable unit testing for the project.
And then click OK.
Repeat the first three steps for each project in the solution.
But you may encounter two main issues or problems with this:
By default, you need to do these operations manually for each project.
Despite seeming an easy task, now imagine doing that if you have almost 200 projects inside a unique Visual Studio Solution! It will be an insane and time-consuming operation.
If it is not that critical when you are creating a brand new project, but the main problem happens when:
We are migrating from on old BizTalk Server version to a newer version.
Or when a new user downloads the source code from TFS or DevOps, and in that case, they need to configure some of these properties before they can deploy the solution to our BizTalk Server environment.
So, is there a better and fast way?
Yes, there is, and that is why I like PowerShell! We can easily script these tasks with a simple PowerShell script and reuse it for all projects.