I have a C# Class Library project targeting .NET Standard 2.0 that uses Unity for Dependency Injection. Unity has a dependency on System.Runtime.CompilerServices.Unsafe (probably version 4.0.4.1).
I am using that dll in another solution where there are some Test projects using Moq nuget which has a dependency on System.Runtime.CompilerServices.Unsafe (version 4.5.0).
When trying to run the second project I am getting the error: "Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)".
Is there a way to bypass the older version of System.Runtime.CompilerServices.Unsafe and use only the most recent?
I have tried redirecting the assembly version (think does not work in .NET Standard though) but without luck for now.