Search Unity

Scripting runtime .NET 4.x DynamicMethod and ILGenerator

Discussion in 'Scripting' started by defic, Jan 7, 2019.

  1. defic

    defic

    Joined:
    Apr 29, 2013
    Posts:
    18
    I was hoping to upgrade from the Deprecated .NET 3.5 Equivalent to the new .NET 4.x Equivalent. However with 4.x I get errors because System.Reflection.Emit does not contain DynamicMethod and ILGenerator anymore. (The type or namespace name 'DynamicMethod' could not be found (are you missing a using directive or an assembly reference?))

    If I increase Api Compatibility Level to .NET 4, the error goes away, but I read that using .NET Standard 2.0 is recommended for mobile. (With runtime .NET 3.5 we used compatibility level .NET 2.0 Subset)

    Is there way to include Dynamic Method library without changing the Api Compatibility Level? I tried adding the System.Reflection.Emit.Lightweight.dll manually to the plugins folder, but got error from duplicate dlls.
     
    Last edited: Jan 7, 2019