Hey,

I am on .NET 3.5, and I'm trying to add a strong name to an unsigned 
assembly using Mono.Cecil 0.9.5.0, obtained from NuGet. I am using the 
following code:

var snk = new StrongNameKeyPair(File.ReadAllBytes(keyFilePath));
> var assembly = AssemblyDefinition.ReadAssembly(filePath);
> assembly.Name.HashAlgorithm = AssemblyHashAlgorithm.SHA1;
> assembly.Name.PublicKey = snk.PublicKey;
> assembly.Name.HasPublicKey = true;
> assembly.Name.Attributes &= AssemblyAttributes.PublicKey;
> assembly.Write(filePath);


Attempting to load the assembly yields a strong name verification failure:

Unhandled Exception: System.IO.FileLoadException: Could not load file or 
> assembly 'euler, Version=1.0.0.0, Culture=neutr
> al, PublicKeyToken=6f6d17194c59df76' or one of its dependencies. Strong 
> name validation failed. (Exception from HRESULT:
>  0x8013141A) ---> System.Security.SecurityException: Strong name 
> validation failed. (Exception from HRESULT: 0x8013141A)


Examining the newly signed assembly with SN.exe -v, I see:

*C:\foo\bar.dll is a delay-signed or test-signed assembly*


How do I use Cecil to create a non-test-signed, regular strong named 
assembly from an unsigned one? I suspect I'm missing something simple.

Thanks

-Oisin

-- 
-- 
--
mono-cecil
--- 
You received this message because you are subscribed to the Google Groups 
"mono-cecil" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to