当我从 Visual Studio 运行 UT 时,一切都运行良好,但是当我需要使用
nunit3-console My.Tests.dll
运行它时,我会看到像这样的 FileNotFoundException
无法加载文件或程序集“System.Security.Cryptography.Xml,...
我只看到来自
Microsoft.AspNETCore.App
文件夹的 DLL,来自 Microsoft.NETCore.App
的 DLL 加载得很好。
测试文件
[Test]
public void Test1()
{
Assembly.Load("System.Security.Cryptography.Xml, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51");
}
如果我显式加载,则测试运行良好
Assembly.LoadFrom("C:\\Program Files\\dotnet\\shared\\Microsoft.AspNetCore.App\\8.0.0\\System.Security.Cryptography.Xml.dll");