I'm working with a custom test adapter being used in MSTest + dotnet test + Visual Studio, and have come across many transitive dependencies clashing in versions (specifically System.Memory, System.Runtime.CompilerServices.Unsafe, and System.Numerics.Vectors). I've found online that .config
files' binding redirects should work when running tests (GitHub), but I can't find any resources on how to make dotnet test (or other test runners) use the custom test adapter's config. I have confirmed that the config exists (as xxx.TestAdapter.dll.config, either through auto-generated binding redirects or manual ones), I just can't work out how to convince a test runner to use it. System.AppDomain
seems to not work (AppDomain.CurrentDomain.SetData("APP_CONFIG_FILE", @"C:\git\...\bin\XXX.TestAdapter.dll.config");
, however I'm less convinced that I've set that up correctly. Thanks!
There's no 'clean' way of doing it that I've found so far, but when implementing a bare AppDomain.CurrentDomain.AssemblyResolve
you're able to ignore the version numbers in the handler to achieve a similar result as assembly bindings (or can respect the numbers of the binding if you choose to implement that too).