Hello again :)

This time i've got a bit more complicated question.
I'm trying to "weaken" strongly typed external reference.

I hoped that these lines of code will achieve that for me:

foreach (AssemblyNameReference reference in
assembly.MainModule.AssemblyReferences)
{
       reference.HasPublicKey = false;
       reference.PublicKeyToken = null;
       reference.PublicKey = null;
}

However result corresponded to my expectations only partially. Here are some
IL blocks of original file:

.............
.assembly extern Ninject.Core
{
  .publickeytoken = (C7 19 2D C5 38 09 45 E7 )                         //
..-.8.E.
  .ver 1:1:3498:33389
}
............
    .custom instance void
[nunit.framework]NUnit.Framework.ExpectedExceptionAttribute::.ctor(class
[mscorlib]System.Type) = ( 
01 00 78 4E 69 6E 6A 65 63 74 2E 43 6F 72 65 2E   // ..xNinject.Core.
41 63 74 69 76 61 74 69 6F 6E 45 78 63 65 70 74   // ActivationExcept
69 6F 6E 2C 20 4E 69 6E 6A 65 63 74 2E 43 6F 72   // ion, Ninject.Cor
65 2C 20 56 65 72 73 69 6F 6E 3D 31 2E 31 2E 33   // e, Version=1.1.3
34 39 38 2E 33 33 33 38 39 2C 20 43 75 6C 74 75   // 498.33389, Cultu
72 65 3D 6E 65 75 74 72 61 6C 2C 20 50 75 62 6C   // re=neutral, Publ
69 63 4B 65 79 54 6F 6B 65 6E 3D 63 37 31 39 32   // icKeyToken=c7192
64 63 35 33 38 30 39 34 35 65 37 00 00 )              // dc5380945e7..
............


And same blocks for modified assembly:

............
.assembly extern Ninject.Core
{
  .ver 1:1:3498:33389
}
............
    .custom instance void
[nunit.framework]NUnit.Framework.ExpectedExceptionAttribute::.ctor(class
[mscorlib]System.Type) = ( 
01 00 78 4E 69 6E 6A 65 63 74 2E 43 6F 72 65 2E   // ..xNinject.Core.
41 63 74 69 76 61 74 69 6F 6E 45 78 63 65 70 74   // ActivationExcept
69 6F 6E 2C 20 4E 69 6E 6A 65 63 74 2E 43 6F 72   // ion, Ninject.Cor
65 2C 20 56 65 72 73 69 6F 6E 3D 31 2E 31 2E 33   // e, Version=1.1.3
34 39 38 2E 33 33 33 38 39 2C 20 43 75 6C 74 75   // 498.33389, Cultu
72 65 3D 6E 65 75 74 72 61 6C 2C 20 50 75 62 6C   // re=neutral, Publ
69 63 4B 65 79 54 6F 6B 65 6E 3D 63 37 31 39 32   // icKeyToken=c7192
64 63 35 33 38 30 39 34 35 65 37 00 00 )              // dc5380945e7..
............


So, the first block was actually fixed, however second one remained
untouched.
Actually I'm not sure about workarounds yet, except for checking all custom
attributes in assembly...

Am I doing something wrong?

Best Regards,
Sergiy

P.S. Thanks for such a quick reply on my previuos post :)
-- 
View this message in context: 
http://www.nabble.com/Weakening-strongly-typed-assembly-references-tp24750303p24750303.html
Sent from the Mono - Cecil mailing list archive at Nabble.com.


--~--~---------~--~----~------------~-------~--~----~
--
mono-cecil
-~----------~----~----~----~------~----~------~--~---

Reply via email to