2
votes

I have a problem with .NET assembly redirection. 3rd party assembly A references another 3rd party assembly B. B is not signed so it doesn't have public key token. Manifest of A:

....
.assembly extern B
{
  .ver 1:0:0:0
}
....

How can I make binding redirection to the next version of B that became signed? If I don't specify publicKeyToken in assemblyBinding/dependentAssembly/assemblyIdentity, runtime can't find assembly "B, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null". If I specify than redirection rule doesn't match dependent assembly reference in metadata.

2
You cannot do this with a simple binding redirect. At least a publisher policy assembly is required to supply the missing key token. The vendor needs to give you one since you don't have the private key. Still not sure if it works after this. Recompiling is the simple solution.Hans Passant
Recompiling of assembly A is not possible because it's 3rd party :-(Dmitry Borovsky

2 Answers

1
votes

If you know the next version is going to be signed, can you just get a copy of the publicKey?

By the way changing from unsigned to signed mid process with out a recompile, technically can be done, but it is a very bad idea.

1
votes

I've found no ways make binding redirection to signed assembly from unsigned. Just one not very good solution I've found is to remove signature from signed assembly. To do it ildasm can be used to disassembly, after public key should be removed from .il file and using ilasm changed .il can be compiled.