Cool way to add existing .Net DLL into Silverlight Project
I found this information from this link
To summarize :-
1. ildasm MyClass.dll /out:MyClass.il
Disassemble your code and change the mscorlib version to 2:0:5:0;
.assembly extern mscorlib
{
.publickeytoken = (7C EC 85 D7 BE A7 79 8E ) // .z\V.4..
.ver 2:0:5:0 }
}
You also need to change the public token key 7C EC 85 D7 BE A7 79 8E
Then you may need to remove public key from your generated IL file
.publickey = (00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00 // .$..............
00 24 00 00 52 53 41 31 00 04 00 00 01 00 01 00 // .$..RSA1........
B5 FC 90 E7 02 7F 67 87 1E 77 3A 8F DE 89 38 C8 // ......g..w:...8.
1D D4 02 BA 65 B9 20 1D 60 59 3E 96 C4 92 65 1E // ....e. .`Y>...e.
88 9C C1 3F 14 15 EB B5 3F AC 11 31 AE 0B D3 33 // ...?....?..1...3
C5 EE 60 21 67 2D 97 18 EA 31 A8 AE BD 0D A0 07 // ..`!g-...1......
2F 25 D8 7D BA 6F C9 0F FD 59 8E D4 DA 35 E4 4C // /%.}.o...Y...5.L
39 8C 45 43 07 E8 E3 3B 84 26 14 3D AE C9 F5 96 // 9.EC...;.&.=....
83 6F 97 C8 F7 47 50 E5 97 5C 64 E2 18 9F 45 DE // .o...GP..\d...E.
F4 6B 2A 2B 12 47 AD C3 65 2B F5 C3 08 05 5D A9 ) // .k*+.G..e+....].
2. ilasm MyClass.il /dll /resource: MyClass.res /out: MyClass2.dll /key:YourStrongNameKey.snk
If you have references to this assembly you need to use back the same name. MyClass2.dll eventually becomes MyClass.dll.
If your class is just a simple class library then you may not need to remove the key token.
Comments