C# - Referencing a type in a dynamically generated assembly

后端 未结 2 1736
走了就别回头了
走了就别回头了 2020-12-03 08:15

I\'m trying to figure out if it\'s possible when you are dynamically generating assemblies, to reference a type in a previously dynamically generated assembly.

For e

2条回答
  •  无人及你
    2020-12-03 08:39

    MSDN says you can:

    Restrictions on Type References

    Assemblies can reference types defined in another assembly. A transient dynamic assembly can safely reference types defined in another transient dynamic assembly, a persistable dynamic assembly, or a static assembly. However, the common language runtime does not allow a persistable dynamic module to reference a type defined in a transient dynamic module. This is because when the persisted dynamic module is loaded after being saved to disk, the runtime cannot resolve the references to types defined in the transient dynamic module.

提交回复
热议问题