Unity version: 2020.3.23f1
Scripting backend: Mono
API compatibility level: .NET 4.x
Platform: Windows Standalone 64
I am trying to use a plugin that depends on Python.Runtime (NuGet Gallery | pythonnet_netstandard_py37_win 2.5.2) version 2.5.2, which targets .NET Standard 2.0.
Since NuGet does not work with Unity, I imported Python.Runtime.dll as follows: Download the .nupkg from the NuGet website, extract it, then import Python.Runtime.dll to Assets/Plugins/x86_64.
I got a compiler error that I was missing System.Security.Permissions.dll, which is a dependency of Python.Runtime. I followed the same procedure described above to get System.Security.Permissions from NuGet (NuGet Gallery | System.Security.Permissions 8.0.0) into my project (there are a few versions of the .dll in the download, I used the .NET Standard 2.0 version). I get the following errors:
Error: Could not load signature of System.Security.HostSecurityManager:smile:etermineApplicationTrust due to: Could not resolve type with token 0100002f (from typeref, class/assembly System.Security.Policy.EvidenceBase, System.Security.AccessControl, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a) assembly:System.Security.AccessControl, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a type:System.Security.Policy.EvidenceBase member:(null) signature:
Unloading broken assembly Assets/Plugins/x86_64/System.Security.Permissions.dll, this assembly can cause crashes in the runtime
and cannot use the library that depends on System.Security.Permissions (calls to it hang indefinitely).
I also tried using a newer version of System.Security.Permissions.dll and redirecting the assembly versions to avoid a version conflict, but I still got similar errors. This reference Unity - Manual: .NET profile support states that .NET Standard plugins can be used with API compatibility level .NET 4.x, does anyone know why this particular DLL won’t load?