Recently I had to do some really nasty work (I consider any IL work
nasty) to get a set of (not strong named) 3rd party assemblies to
compile with our solution (which is strong named).
DISCLAIMER:
We've notified the 3rd party and a strong named version will be
provided in the next release, but in the mean time for our internal
development and testing to continue we've had to do some hacking.
I do not recommend this technique with regards to production systems.
Get your provider to strong name their assemblies or choose another
provider.
The basic idea is something that has floated around on the newgroups
from time to time. The ildasm/ilasm trick. Essentially disassembling
the original assembly to IL, and then assemble it back to assembly with
a strong name key (in this case, our own one).
There is a further trick that I wanted to mention.
The scenario is as follows:
If the 3rd party assemblies are:
Assembly A,
Assembly B.
A references B
And in our solution we use both
Assembly A, B.
The IL generated in the original Assembly A will show something like
this in relation to the reference to B:
..assembly extern B
{
.ver 1:0:0:0
}
You need to modify the IL and insert your own public key here before
re-assembling "A" again.
..assembly extern B
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 )
// .z\V.4..
.ver 1:0:0:0
}
(this example key is the mscorlib key - use your own public key that
you used to sign B)
This 'fix' is necessary because if we don't modify the reference here,
when we re-assemble "A", the reference information won't be updated,
then when we build our solution which references both A and B, it would
be fine with B, but with A it will error saying:
Assembly generation failed -- Referenced assembly 'B' does not have a
strong name
I saw a few posts here and there that related to this problem, but had
no solutions. Hope this helps someone (eventually/somewhere).
jliu
johnliu.net