PageRenderTime 112ms CodeModel.GetById 71ms app.highlight 1ms RepoModel.GetById 39ms app.codeStats 0ms

/src/LinFu.AOP/AssemblyDefinitionExtensions.cs

http://github.com/philiplaureano/LinFu
C# | 25 lines | 15 code | 2 blank | 8 comment | 0 complexity | c3d22a609a32536043765927ce150175 MD5 | raw file
 1using Mono.Cecil;
 2
 3namespace LinFu.AOP.Cecil
 4{
 5    /// <summary>
 6    ///     A class that extends <see cref="AssemblyDefinition" /> instances.
 7    /// </summary>
 8    public static class AssemblyDefinitionExtensions
 9    {
10        /// <summary>
11        ///     Removes the strong-name signature from the <paramref name="sourceAssembly" />.
12        /// </summary>
13        /// <param name="sourceAssembly"></param>
14        public static void RemoveStrongName(this AssemblyDefinition sourceAssembly)
15        {
16            var nameDef = sourceAssembly.Name;
17
18            // Remove the strong name
19            nameDef.PublicKey = null;
20            nameDef.PublicKeyToken = null;
21            nameDef.HashAlgorithm = AssemblyHashAlgorithm.None;
22            nameDef.HasPublicKey = false;
23        }
24    }
25}