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 custom type from an unsigned referenced assembly was used within the 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 one .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
- 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).
- 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. - In Visual Studio Solution Explorer, right-click the project and then click Properties.
- Click the Signing tab and choose to Browse in the Choose a strong name key file drop-down box.
- 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.
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 a unique argument like
resign.bat somelibrary
This permits you to resign every assembly without the need of source code.
nice tip…very helpful information 🙂