public AssemblyDelaySignAttributeTest () { //create a dynamic assembly with the required attribute //and check for the validity dynAsmName.Name = "TestAssembly"; dynAssembly = Thread.GetDomain ().DefineDynamicAssembly ( dynAsmName,AssemblyBuilderAccess.Run ); // Set the required Attribute of the assembly. Type attribute = typeof (AssemblyDelaySignAttribute); ConstructorInfo ctrInfo = attribute.GetConstructor ( new Type [] { typeof (bool) } ); CustomAttributeBuilder attrBuilder = new CustomAttributeBuilder (ctrInfo, new object [1] { false }); dynAssembly.SetCustomAttribute (attrBuilder); object [] attributes = dynAssembly.GetCustomAttributes (true); attr = attributes [0] as AssemblyDelaySignAttribute; }