0

直到上个月,我们才能在 Azure Devops 构建管道中运行单元测试并将代码覆盖率发布到 sonarqube。现在我们在 .NET 代码的 Visual Studio 测试任务中收到以下错误。

测试运行将使用为框架 .NETFramework、Version=v4.0 和平台 X86 构建的 DLL。以下 DLL 与框架/平台设置不匹配。MedicareActual.Api.Tests.dll 是为 Framework 3.1 和 Platform AnyCPU 构建的。Microsoft.AspNetCore.TestHost.dll 是为 Framework 3.1 和 Platform AnyCPU 构建的。Microsoft.TestPlatform.CommunicationUtilities.dll 是为 Framework 1.4 和 Platform AnyCPU 构建的。Microsoft.TestPlatform.CoreUtilities.dll 是为 Framework 1.4 和 Platform AnyCPU 构建的。Microsoft.TestPlatform.CrossPlatEngine.dll 是为 Framework 1.4 和 Platform AnyCPU 构建的。Microsoft.TestPlatform.PlatformAbstractions.dll 是为 Framework 1.0 和 Platform AnyCPU 构建的。Microsoft.VisualStudio.TestPlatform.Common.dll 是为 Framework 1.4 和 Platform AnyCPU 构建的。Microsoft.VisualStudio.TestPlatform.ObjectModel.dll 是为 Framework 1 构建的。4和平台AnyCPU。testhost.dll 是为 Framework 1.0 和 Platform AnyCPU 构建的。

我们已经尝试使用测试文件中的上述特定 .dll 覆盖测试运行参数/其他控制台选项。但没有用。

4

1 回答 1

0

以前版本Visual Studio 16.2. 它已经固定在Visual Studio 16.2 这里

如果您遇到同样的问题尝试使用最新的 Visual Studio 版本https://visualstudio.microsoft.com/downloads/

遇到类似问题的人有解决方案。在这里查看更多信息

于 2021-08-08T10:10:59.940 回答