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

Posted: November 13, 2015 in BizTalk, PowerShell
Tags: , , , , , , ,

In the previous post it was provide 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 sigh the assemblies involved in the project to give them an 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. This assemblies needs to be strongly signed so that they can have a 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.


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 the most likely to happen is you to 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") 
        $xml.Project.InsertBefore($childItemGroup, $xml.Project.Import[0]) 

You can download the PowerShell Script used here from:

BizTalk Server: Fixing BizTalk Project Signing Properties with PowerShell (2 KB)
Microsoft | TechNet Gallery

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s