dialex dialex - 1 year ago 115
C# Question

C#: Signing DLL with strong name (what about its dependencies?)

A while ago I asked about "DLL caused an exception" when calling a method that references another DLL. On that time I had no clues but now I think what may be causing the problem.

Assume I have an

calling a
which requires a
. When I signed
with a strong name, for some reason all calls to
's methods started returning the error below:

System.Exception: Error while trying to call method X from DLL1.
---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.IO.FileLoadException: Could not load file or assembly 'DLL2', Version=2.1.5899, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required.

Does this mean I have to strongly name every DLL along the dependency chain?

I had to sign the first DLL because otherwise I would get a warning during

Answer Source


a signed assembly cannot call an unsigned assembly. That's part of the trust chain and it does indeed mean you will have to sign all dependencies of your signed assembly.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download