How to access Add-Type defined type in other Add-Type type definition?

后端 未结 2 596
遥遥无期
遥遥无期 2021-01-05 06:16

How to access a type defined by Add-Type -TypeDefinition \"...\" in another Add-Type -TypeDefinition \"...\"?

In the following code example

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-05 07:21

    This isn't possible with dynamic assemblies (which are generated by default if you don't specify other parameters.)

    You can generate dlls with Add-Type and reference them later, so something like:

    Add-Type -OutputAssembly foo1.dll ...
    Add-Type -ReferencedAssemblies foo1.dll ...
    

    should work.

提交回复
热议问题