Tag Archives: Automated Migration using Visual Studio

BizTalk Automated migration Tool

Watch the Video – BizTalk Automated Migration Tool Demo –

Microsoft has recently released BizTalk 2020 with lots of new features and enhancements.

There are many reasons to Migrate and can be broadly summarized as below –

  1. Avail Microsoft Support
    • BizTalk 2016 Mainstream Support Ends – 1st November 2022
    • All other previous versions like 2013R2, 2013 or 2010 etc. are long out of mainstream support
    • Upgrade to latest software version of OS, VS, SQL & BizTalk
  2. Enhance BizTalk Environment
    • For better infrastructure, performance, topology – HA/DR
  3. Avail New features
    • BizTalk 2020 is loaded with new features of Hybrid Integration, Improvised Security (TLS1.2, GDPR compliance), Better Monitoring etc.
    • Feature packs – Get new features faster, without waiting for new versions
    • New Features for Developers and Administrators
  4. Move to Cloud
    • Ability to run on Azure VM as IaaS

Microsoft has always attempted to make migrations as seamless and easy as possible by providing various options like –

  1. In-Place Upgrade – Only possible for N-1 version
  2. BizTalk Server Migration Tool – Which performs as-is migration by exporting artifacts from previous environment to new environment.

In-Place Upgrade is more like installing Cumulative Updates or Feature Pack. It requires minimum efforts and is mostly very seamless but has many limitations like only possible for N-1 version, rollback is tough.

BizTalk Server Migration Tool is provided by MSIT and is extremely helpful for as-is migration. On high level it exports MSI, Binding Files etc. from old environment and imports in the new environment. So all the dlls still point to previous version and nothing is changed.

For as-is migration, it definitely saves lots of time and efforts but has limitations like we can’t use new features or enhancements.

Therefore, many organisations prefer to use traditional method of code migration, which allows code upgrade, enhancement and possibility of modernization. But, this process is definitely very lengthy, time taking and resource intensive.

As a BizTalk Developer, Migration operations can be broadly categorized as below –

  1. Migrate to Latest Visual Studio – Open each solution in Visual Studio, by default it will upgrade solution to VS. It will also change the dotnet framework for all BizTalk projects.
  2. DotNet Framework Change – You may have to change DotNet Framework for Class Library Projects like Pipeline Components, Helper/Components, Custom Functoids, Custom Adapters etc. as they aren’t changed with VS Upgrade.
  3. Add BTDF or other Deployment Project (Optional)
  4. Rebuild Solution – Review failures and fix them.
  5. E2E Testing – End to end testing with all the parties involved in integration.

Performing all these operations for hundreds and thousands of applications is extremely tedious, time taking and resource intensive work. Every year companies spend thousands of man-hours just to perform these migration activities.

We attempted to reduce the efforts for developers by automating most of the routine tasks and only focus on things which really require human intervention.

We created a tool which solves top 4 problems and performs them as One-Click Operation.

Operations which can be Automated By Tool –

  1. Upgrade Solutions to Latest Visual Studio
  2. Change .Net Framework for all Projects
  3. Add BTDF Project to solution, with proper changes to Deployment.btdfproj file
  4. Rebuild Solution
  5. Detailed Logging of each operation for quick access to successful and failed solutions

Proposed Steps –

  1. “Browse for Folder with all applications”
  2. Get List of all the Solutions in that folder.
  3. Choose from Migration Operations –
    • Upgrade – This will upgrade to latest visual studio version.
    • Add BTDF Project – Adds BTDF Template project will all the files
    • Build – Performs Rebuild of all the solutions/projects
    • Change .Net Framework to Target Version – Select target Dotnet framework from the dropdown. All the projects will be migrated to this version, especially helpful for helper libraries like pipeline component, custom functoids, adapters and other helper components
  4. Detailed logging can be performed for each operation.
  5. You can also create folders and generate/move outputs to different folders like – “UpgradeSuccessful”, “UpgradeFailed”, “BuildSuccessful” and “BuildFailed”

This will allow developers to only focus on applications for which Build Operation failed.

Detailed Description of each operation –

Migrate Operation –

This operation is similar to manually Opening each solution in Visual Studio which performs

a) Upgrade to latest VS and

b) Change of .Net framework (to default version) for BizTalk projects (only BizTalk Projects(.btproj) not class library projects(.csproj)).

It also creates Backup folder with migrated projects and log file – “UpgradeLog.htm” next to the solution file. You can also choose to delete the backup file, to save space if you already have another backup.

To perform this operation from tool you can use visual studio command line arguments –

devenv {SolutionFile|ProjectFile} /Upgrade [/Out OutputFilename]

Refer –

https://docs.microsoft.com/en-us/visualstudio/ide/reference/upgrade-devenv-exe?view=vs-2019

Build Operation –

Similarly, Build operation can also be performed by VS command line arguments –

devenv SolutionName /Rebuild [SolnConfigName [/Project ProjName [/ProjectConfig ProjConfigName]] [/Out OutputFilename]]

Refer –

https://docs.microsoft.com/en-us/visualstudio/ide/reference/rebuild-devenv-exe?view=vs-2019

Most of the errors in this step is related to missing reference of common libraries or helper projects/dlls.

Change DotNet Framework –

You can allow users to choose target framework from a dropdown and later upgrade all projects in solution to this version. These values can be fetched from App.config file.

Your tool can get the list of all the projects referred/present in Solution (Solution file) and later change their .Net framework for each of them.

Regular VS Upgrade option performs .Net framework changes only to BizTalk projects and that too only to default version.

Note – For BizTalk 2020 we found a bug with .Net Framework 4.7.2, so we decided to migrate all the projects to 4.8 version. This tool was extremely helpful in mass framework change.

It’s also extremely helpful for helper class libraries like pipeline components, custom functoids, custom adapters or C# Helper/Component projects which are not upgraded in Upgrade process.

Dotnet Framework can be upgraded just by updating the project files.

  1. In the project file, locate the entry for the target Framework version. Ex -if your project is designed to use the .NET Framework 4.5, locate <TargetFrameworkVersion> v4.5 </ TargetFrameworkVersion > in the <PropertyGroup Label = “Globals” > element of the < Project > element.

If the<TargetFrameworkVersion> element isn’t present, your project doesn’t use the.NET Framework and no change is required.

2. Change the value to the Framework version you want, such as v4.7.2 or v4.8.

You can also use Regex pattern replace –

string regexPattern = “<TargetFrameworkVersion>*.*</TargetFrameworkVersion>”;

3. Save the changes and close the editor.

Refer –https://docs.microsoft.com/en-us/cpp/build/how-to-modify-the-target-framework-and-platform-toolset?view=vs-2019

Add BTDF Project –

In this step you can add a template of BTDF project with Deployment folder and all other files –

  • Deployment.btdfproj
  • InstallWizard.xml
  • License.rtf
  • PortBindingsMaster.xml
  • SettingsFileGenerator.xml
  • UnInstallWizard.xml

You can also update the Deployment.btdfproj file with many routine information like –

  • ProjectName – Solution File
  • Include Options for
    • Schemas
    • Maps/Transforms
    • Orchestrations
    • PipelineComponents
    • Helpers – Components
    • And many other options

These options can be read and populated by fetching project names or file’s extension from solution file.

For ex – If Solution contains projects with name as “Schemas” or files with extension “.xsd” then make IncludeSchemas as True.

Similarly, for Maps, Orchestrations, PipelineComponents etc. can be deduced either from name( if naming convention is followed for BizTalk projects) or file extensions like .btm for maps, .odx for orchestrations, .btp for pipelines etc.

Sample BTDF Template -
    <!-- Deploy schemas -->
    <IncludeSchemas>True</IncludeSchemas>
    <!-- Deploy orchestrations -->
    <IncludeOrchestrations>True</IncludeOrchestrations>
    <!-- Deploy maps -->
    <IncludeTransforms>True</IncludeTransforms>

Many sections like below which are mostly constant can be updated from App.Config file.

    <!-- Deploy custom functoids -->
    <IncludeCustomFunctoids>False</IncludeCustomFunctoids>
    <!-- Deploy BRE -->
    <IncludeVocabAndRules>False</IncludeVocabAndRules>
    <!-- Deploy IIS virtual directories -->
    <IncludeVirtualDirectories>False</IncludeVirtualDirectories>
    <!-- Deploy NUnit tests -->
    <IncludeDeploymentTest>False</IncludeDeploymentTest>
    <!-- Deploy Log4Net configuration file named $(ProjectName).log4net -->
    <Includelog4net>False</Includelog4net>

This tool has helped us in saving thousands of hours monotonous, repetitive and boring work.

Hope it helps you as well.

Feel free to get in touch in case of any query. Thanks.

Contact Me:- 

@Gmail@Facebook , @Twitter, @LinkedIn @MSDNTechnet, @My Personal Blog 

Related Article –

PLANNING MIGRATION TO BIZTALK 2020 – WHY AND HOW?

https://prashantbiztalkblogs.wordpress.com/2020/08/28/planning-migration-to-biztalk-2020-why-and-how/

Contact Me –

Check out my other blogs –

Function App throws “System.OutOfMemoryException” Error

One of our Function Apps has been frequently failing with the “Out of Memory” exception. It was an intermittent access, where Function App crashes at random intervals. Error Message – Exception while executing function: FuncApp. One or more errors occurred.An exception was thrown by a TaskScheduler.Exception of type ‘System.OutOfMemoryException’ was thrown. After lots of troubleshooting,…