When I run UTs from Visual Studio all runs fine but when I need to run it with nunit3-console My.Tests.dll I see FileNotFoundException like this
Could not load file or assembly 'System.Security.Cryptography.Xml, ...
I see them only for DLLs from Microsoft.AspNETCore.App folder, DLLs from Microsoft.NETCore.App are loaded fine.
The test file
[Test]
public void Test1()
{
Assembly.Load("System.Security.Cryptography.Xml, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51");
}
If I explicitly load then tests run fine
Assembly.LoadFrom("C:\\Program Files\\dotnet\\shared\\Microsoft.AspNetCore.App\\8.0.0\\System.Security.Cryptography.Xml.dll");
Look like its an inner issue with
NUNIT3-CONSOLE's how the runtime locates assemblies, read about it here.It can be solve easily with using the dotner cli with
dotnet test.If you must use it (would be happy to know why), you can try to modify the runtime configuration.
[YourTestAssembly].runtimeconfig.jsonsomething like:Change the target verion number.