The suite of unit tests I have immediately fails the test run with System.DllNotFoundException: Unable to load DLL 'SQLite.Interop.dll' which is a dependency required within the test [AssemblyInitialize] methods.
I've determined this is caused by executing any test that is using the [DeploymentItem] attribute and is the case for either a class or method. Any tests that do not use this attribute pass.
With Test Diagnostic logging enabled in VS2019 there are no obvious errors but I can see this config.
<RunSettings>
<RunConfiguration>
<ResultsDirectory>D:\Dev\****\src\TestResults</ResultsDirectory>
<SolutionDirectory>D:\Dev\****\src\</SolutionDirectory>
<TargetPlatform>X86</TargetPlatform>
<CollectSourceInformation>False</CollectSourceInformation>
</RunConfiguration>
</RunSettings>
My test projects are all configured for <PlatformTarget>AnyCPU</PlatformTarget> so I wonder if the SQLite.Interop.dll is not found because of an issue with x86 vs x64.
<RunSettings>?SQLite.Interop.dll not be found?UPDATE
Using procmon.exe filtering for testhost.exe and SQLite.Interop.dll I can see that a test without [DeploymentItem] attributes starts looking for the dll in the project bin\Debug folder which finds it at bin\Debug\x64\SQLite.Interop.dll.
Those tests with the attribute starts looking in the Test Results directory TestResults\...\Out then all across the machine C:\Windows, C:\Program Files, C:Users but never further under bin\Debug.
Running the same tests using VSTest.Console.exe does not have this issue.
.\Out directory for the unit tests?To resolve;
<DisableAppDomain>True</DisableAppDomain>, see Configure a test runNote that run settings cannot be retained at the project or solution level and need to be set in the IDE; https://developercommunity.visualstudio.com/content/problem/151608/ability-to-set-runsettings-in-project-file.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With