gpt4 book ai didi

unit-testing - MSTest 异常 : Unit Test Adapter threw exception: Type is not resolved for member

转载 作者:行者123 更新时间:2023-12-04 03:27:34 26 4
gpt4 key购买 nike

在我的项目中,我使用 Microsoft 的单元测试框架编写测试。当我从 Visual Studio 运行它们时,我的所有测试都通过了,但是当我从 MSBuild 运行测试时,所有测试都失败了,并显示以下错误消息:

Unit Test Adapter threw exception: Type is not resolved for member SomeType,SomeAssembly Version=assemblyVersion, Culture=neutral, PublicKeyToken=..



未找到的程序集是所有项目引用的第 3 方程序集。

TFS 使用构建脚本,所以我添加了以下几行:
<RunTest>true</RunTest>

<ItemGroup>
<MetaDataFile Include="$(BuildProjectFolderPath)myproject.vsmdi">
<TestList>CI_Tests</TestList>
</MetaDataFile>
</ItemGroup>

我找到了 this post这显示了此问题的解决方案,但不幸的是我无法更改 TFS 服务器上的文件。

帮助!

最佳答案

首先要检查此程序集是否复制到 msbuild 运行测试的文件夹。由于某些历史原因,您的 bin/Debug 文件夹中可能有一个副本,但项目中的依赖项未正确设置。

关于unit-testing - MSTest 异常 : Unit Test Adapter threw exception: Type is not resolved for member,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3085140/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com