Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-core/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 集成测试无法加载文件或程序集_C#_Asp.net Core_Integration Testing - Fatal编程技术网

C# 集成测试无法加载文件或程序集

C# 集成测试无法加载文件或程序集,c#,asp.net-core,integration-testing,C#,Asp.net Core,Integration Testing,我在xunit集成测试中不断遇到问题 集成测试项目设置为目标.NET 4.6.1 集成测试项目引用了ASP.NET核心(针对net461)项目a 项目A引用了一个.NET标准库,该库使用System.Security.Cryptography.x509证书,版本=4.1.0.0,我们称之为项目B 从我的集成测试项目创建TestServer时,测试失败 Message: System.IO.FileLoadException : Could not load file or assembly 'S

我在xunit集成测试中不断遇到问题

集成测试项目设置为目标.NET 4.6.1

集成测试项目引用了ASP.NET核心(针对net461)项目a

项目A引用了一个.NET标准库,该库使用
System.Security.Cryptography.x509证书,版本=4.1.0.0
,我们称之为项目B

从我的集成测试项目创建TestServer时,测试失败

Message: System.IO.FileLoadException : Could not load file or assembly 'System.Security.Cryptography.X509Certificates, Version=4.1.0.0, 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).
但是,当单独运行项目A时,它本身不需要引用
System.Security.Cryptography.X509Certificates
。我假设这是因为项目B已经有了这个参考


我如何确保我的集成测试项目能够解决其与下游项目的所有依赖关系?

因此项目A是一个aspnet核心项目,并且它有一个使用System.Security的项目B的参考。。。?如果是这样的话,项目A间接引用了dotnet标准,因为它本身引用了项目B。@jpgrassi奇怪的是,我将我的单元测试项目转换为xUnit.NET核心,目标是net461。我所有的间接引用都刚刚开始工作,没有任何问题。你的目标是完整的框架吗?现在我感到困惑了。@jpgrassi我有一些.NET核心项目,它们以整个框架为目标,因为有一些依赖关系。