Search Unity

UWP + IL2CPP build error due to System.Runtime version differences

Discussion in 'Windows' started by briank, Jun 16, 2018.

  1. briank

    briank

    Joined:
    Mar 25, 2017
    Posts:
    74
    I have a handful of managed UWP class libraries that are compiled targeting UWP min and target of 16299. I'm attempting to use them as WSA plugins in Unity 2018.1.0f2 with IL2CPP scripting backend and .NET 4.X scripting runtime version.

    Error message I get when building is the following:

    Assembly 'xyz' with identity 'xyz, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'System.Runtime, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' which has a higher version than referenced assembly 'System.Runtime' with identity 'System.Runtime, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

    ILSpy confirms that my 'xyz' assembly does indeed use 4.2.1.0 version of System.Runtime. Since the error message implies the runtime version in my plugin dll is to high, how can I lower it? My best guess is that this may be controlled via the version of that project's Microsoft.NetCore.UWP nuget package(?).

    Any advice would be appreciated!
     
  2. briank

    briank

    Joined:
    Mar 25, 2017
    Posts:
    74
    I've got past the build error by lowering the min/target version of the UWP class libraries to 15063. In fact, I've ended up lowering the min/target to 14393 and now ILSpy reports that the System.Runtime version in the UWP class library is 4.0.20.0 (as opposed to the previous 4.2.1.0).

    Unfortunately, what I'm trying to achieve ultimately doesn't work due to a runtime error when making a network request. This looks like a bug in 2018.1 UWP+IL2CPP. Luckily, it seems to be fixed in 2018.2 beta (it did not repro there). Still, it's too bad because this prevents the plugin from working in 2018.1 + IL2CPP. There is a silver lining though: switching to .NET scripting backend works as expected on 2018.1.

    EDIT: That aforementioned bug no longer repos in 2018.1.5f1! It was fixed in 2018.3f1.
     
    Last edited: Jun 17, 2018