How can i change the assembly's attributes at runtime? RRS feed

  • Question

  • i know how to get the assembly's attributes at runtime, it's like this:

    Assembly asm = Assembly.GetExecutingAssembly();
    string asmDesc = ((AssemblyDescriptionAttribute)asm.GetCustomAttributes(typeof( AssemblyDescriptionAttribute ), false )[0]).Description;

    but how to set it at runtime??
    I just found AssemblyBuilder.SetCustomAttribute(),  but can AssemblyBuilder be used in current asm or a assigned asm?


    Thursday, September 9, 2010 8:38 AM


  • You can't change an assembly's attributes at runtime. The AssemblyBuilder class targets the creation of new assemblies. Usually these are dynamic assemblies that are created at runtime, but always new assemblies, it never changes an already existing assembly.
    -- Blog:
    • Marked as answer by SamAgain Thursday, September 16, 2010 7:29 AM
    Thursday, September 9, 2010 9:01 AM