How to resolve "Multiple Precompiled Assemblies" error

Our project is currently attempting to use DOTS and Grpc, but we are running into some conflicts with the dlls. It appears that the com.unity.collections@0.5.1-preview.11 package includes System.Runtime.CompilerServices.Unsafe.dll, which the Grpc plugin also includes, but at a slightly higher version (4.0.4.1 instead of 4.0.4.0). Since there are now 2 dlls of the same name in the project, this results in this error:

PrecompiledAssemblyException: Multiple precompiled assemblies with the same name System.Runtime.CompilerServices.Unsafe.dll included for the current platform. Only one assembly with the same name is allowed per platform.

If I delete the unsafe dll in the Grpc plugin, the error goes away but Grpc throws an exception at runtime because it can’t find the correct version of the dll. Grpc references this dll indirectly through the System.Memory.dll, so as far as I can tell, the only way I can change the version of that dll to match is to recompile Grpc and System.Memory. It doesn’t look like there’s any way to modify the collections package.

Is there a better way to handle conflicting dlls in Unity? Normal C# apps could use bindingRedirects but those don’t seem to be supported.

I found a workaround for this; I used ILMerge to merge GRPC and all of it’s dependencies into one .dll and made the deps internal. This avoids the error, but does mean that I’m essentially shipping multiple copies of the dlls, and may not be a viable option for all libraries.