Velvet Star Monitor

Standout celebrity highlights with iconic style.

updates

RouteDebug from NuGet does not have a strong name

Writer Andrew Henderson

Today I had a problem with some routing in my ASP.NET MVC 3 application (with Visual Studio 2010).

So I thought I install the ASP.NET RouteDebugger and fix my route problem.

After I get the package through NuGet my project doesn't build anymore:

referenced assembly ' RouteDebug' does not have a strong name

I could download the source of the RouteDebugger and build (and strongly sign) it myself, but that's not the purpose of NuGet isnt' it ;)

Anyone else had this problem and maybe fixed it?

5 Answers

Well, the problem is not really related to NuGet. You cannot reference unsigned assembly from a signed assembly. And because the RouteDebug.dll as contained in the NuGet package is not strongly signed you won't be able to use it if your application is strongly signed. So you basically have two possibilities to choose from:

  1. Download the source code of RouteDebug and compile it yourself by signing it with a strong key
  2. Remove the strong key signature from your hosting application.
4

It is possible to sign an already compiled assembly without having to use the source code. This is explained here: . In short, you need to use ildasm to get the IL for the assembly, then use ilasm to regenerate the dll, this time signed:

ildasm SomeAssembly.dll /out:SomeAssembly.il
ren SomeAssembly.dll SomeAssembly.dll.orig (for backup purposes)
ilasm SomeAssembly.il /dll /key= keyPair.snk

But yes, using unsigned NuGet packages in a project with signed assemblies is a pain in the ass...

This is a recognized shortcoming of nuget, as discussed here.

This is a common problem as many nuget packages are not strong named. It is possible to work around this by dynamically giving any included nuget packages a strong name at build time. Include nuget add package "Brutal.Dev.StrongNameSigner" to your project. Then in your .csproj file, add a reference thus:

<Target Name="BeforeBuild"> <Exec ContinueOnError="false" Command="&quot;..\packages\Brutal.Dev.StrongNameSigner.1.8.0\tools\StrongNameSigner.Console.exe&quot; -in &quot;..\packages&quot;" />
</Target>

Then at compile time, your unsigned nuget references will get a signature generated, and your assembly refernces will be updated to match the newly generated signature.

nuget:

project:

Add StrongNamer to your nuget dependency list and it will automatically sign any unsigned references without having to add any additional build steps yourself.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy