Unable to load dll after it was signed

378 views Asked by At

I have a dll which was initially not strongnamed. Applications were successfully loading it.

But after signed it with .snk key-file, applications refuse loading it and throw System.IO.FileNotFoundException.

If I rebuild it without snk, it is successfully loaded

What is the reason?

1

There are 1 answers

1
AudioBubble On

Most likely thing is your applications previously were using another version of the dll that had been "slyly" copied by Visual Studio and ended up on the deployment machines by accident at some point (yes it looks like versioning problems). Once you signed the dll you were meant to use the side effect was the alternative dll could not be used anymore.

Another possibility is that you used build for "any cpu" and the outcome was different once the dll was signed. I have seen such unpredictable behaviour across the board from "any cpu" builds. Microsoft what were you thinking of?

The not found dll error could be referring to a dependency, I am not sure because I have not needed to sign a dll for over five years, but is there library dlls which are not signed and expected to be or simply not compatible with a signed parent dll. On the subject of "any cpu", signing may require an explicit build for 32 or 64 bit.