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

In my previous post, I provided a PowerShell script to fix or configure the Deployment Properties of a BizTalk project. However, and this is also nothing new, before deploying a BizTalk project we must first strongly sign the assemblies involved in the project to give them a unique identification for allowing them to be installed into the GAC.

GAC (Global Assembly Cache) is a machine code cache that stores assemblies that can be shared by multiple applications on the computer. These assemblies need to be strongly signed so that they can have unique identification in the GAC.

A strong-named assembly provides several security benefits:

  • A strong name guarantees the uniqueness of the assembly by assigning a digital signature and a unique key pair.
  • A strong name protects the lineage of the assembly by ensuring that no one else can generate a subsequent version of the assembly.
  • A strong name provides a strong integrity check to guarantee that the contents of the assembly have not changed since the last build.

In the process of deploying a BizTalk solution, Visual Studio first builds the assemblies. The deployment process requires that each assembly is strongly signed. You can strongly sign your assemblies by associating the project with a strong name assembly key file. If you haven’t already done so, before deploying a solution from Visual Studio, use the following procedure to generate a strong name assembly key file and assign it to each project in the solution.

To configure a strong name assembly key file

  • In Visual Studio Solution Explorer, right-click the project and then click Properties.
  • Click the Signing tab and choose “Browse…” or “New…” in the Choose a strong name key file drop-down box.
  • Create a new key or browse to the key file and click it. Click Open, and then close the project properties.
  • Repeat steps 3 through 6 for each project in the solution that you want to deploy using this strong name assembly key file.
Signing Properties BizTalk Project Visual Studio

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

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… once again.

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.

foreach($node in $allPropertyGroup) 
    { 
        if($node.AssemblyOriginatorKeyFile -ne $null) 
        { 
            $node.AssemblyOriginatorKeyFile= "<keyname>.snk"; 
        } 
    } 
 
    if($xml.Project.ItemGroup.None -eq $null) 
    { 
        $childItemGroup = $xml.CreateElement("ItemGroup",$xdNS) 
        $childNone = $xml.CreateElement("None",$xdNS) 
        $childNone.SetAttribute("Include", "<keyname>.snk") 
        $childItemGroup.AppendChild($childNone) 
        $xml.Project.InsertBefore($childItemGroup, $xml.Project.Import[0]) 
    }

Download

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

You can download Visual Studio: Fixing BizTalk Project Signing 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 Signing Properties of a BizTalk Project with PowerShell”

Leave a Reply

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

turbo360

Back to Top