Is it possible to Add/Remove/Change an embedded resource in .NET DLL?

后端 未结 3 1533
后悔当初
后悔当初 2020-12-05 05:18

Is it possible to add/remove/change an embedded resource in a .NET DLL after it has been compiled? If so, how is this done, and are there any gotchas?

Edit:<

3条回答
  •  [愿得一人]
    2020-12-05 05:52

    Yes, this is possible, by doing a roundtrip with ILDASM and ILASM, replacing the embedded files inbetween.

    Gotchas:

    • you need the strong name key file if the assembly was strong-named, or you'll not get the same assembly name in the end
    • if the assembly was signed with a certificate, you need the certificate including the private key to re-sign it if needed
    • obfuscated assemblies may fail to roundtrip due to name issues

提交回复
热议问题