BizTalk building solution problem – Assembly generation failed — Referenced assembly ‘…’ does not have a strong name

Posted: October 10, 2010 in BizTalk
Tags: ,

A friend of mine who is taking the first steps in BizTalk, called me to ask me how to solve this error:

“Assembly generation failed — Referenced assembly ‘…’ does not have a strong name”

CAUSE

  • This problem occurs when a type from an unsigned referenced assembly is used within an orchestration.

SOLUTION

  • Apply a strong name to the referenced assembly. If it is a custom assembly that you can recompile, use the strong name tool to create an .snk (key) file and then reference that key file in the assembly properties for the project. For more information about strong naming an assembly

To configure a strong name assembly key file

  1. On the Start menu, point to All Programs, point to Microsoft Visual Studio 2010, point to Visual Studio Tools, and then click Visual Studio Command Prompt (2010).
  2. At the command prompt, from the folder where you want to store the key file, type the following command, and then press ENTER:
    sn /k file_name .snk
    Example: sn /k ErrorHandling.snk
    A confirmation message, Key pair written to <file_name>.snk, displays on the command line.
  3. In Visual Studio Solution Explorer, right-click the project and then click Properties.
  4. Click the Signing tab and choose Browse in the Choose a strong name key file drop down box.
  5. Browse to the key file and click it. Click Open, and then close the project properties.
  6. Repeat steps 3 through 6 for each project in the solution that you want to deploy using this strong name assembly key file.

References:

 

For those assemblies that are open source you can simply recompile everything with a strong name. But for those that come already compiled by a 3rd party, you need to disassemble and reassemble again with a strong name.

To make everything simple I usually use this batch

call "%VS80COMNTOOLS%vsvars32.bat"
ildasm /all /out=%1.il %1.dll
ilasm /dll /key=….actvalue.snk %1.il
pause

You can invoke it passing the assembly file name as unique argument like

resign.bat somelibrary

This permits you to resign every assembly without the need of source code.

References:

Tags: BizTalk | building | Errors and Warnings, Causes and Solutions

Comments
  1. Venu says:

    nice tip…very helpful information🙂

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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