调用执行器时发生异常 'executor://xunit/VsTestRunner2/uap': 无法加载文件或程序集 'System.IO.FileSystem
An exception occurred while invoking executor 'executor://xunit/VsTestRunner2/uap': Could not load file or assembly 'System.IO.FileSystem
当我运行在 VSTS 构建上进行单元测试时,我遇到了一个问题。
当我在本地 Visual Studio 上启动所有测试时,一切正常。完全没有错误。完美的。
但是当我通过 VSTS 构建上的测试任务启动我的测试时,出现此错误:
An exception occurred while invoking executor
'executor://xunit/VsTestRunner2/uap': Could not load file or assembly
'System.IO.FileSystem, Version=4.0.1.0, Culture=neutral,
PublicKeyToken=***********' or one of its dependencies. The
system cannot find the file specified.
我的测试项目是这样设置的:
"xunit.runner.visualstudio" 在版本 2.4.0 上 "targetFramework" 设置为 "net462"(在 packages.config 内设置)
.NET Framework 4.6.2
在我的构建服务器上:
Visual Studio 2017, v15.7.5
Visual Studio 2015, v14.0
我运行找不到线索了……我肯定漏掉了什么……
感谢您的帮助
PS:
- 在 VSTS 构建中正确通过了所有测试
- 在我的构建任务的设置中,当我将 "Test platform version" 设置为 "Visual Studio 2015" 时,它起作用了。但是当我选择 "Visual Studio 2017" 或 "Latest" 我有同样的错误...
编辑
我有 Nuget 包 "FluentAssertions" v5.4.1 和 "System.ValueTuple" v4.5.0。我已经尝试降级其中一个和两个。它失败了。但是我看到 "FluentAssertions" 依赖于 "System.ValueTuple"
编辑 2
正如@PatrickLu-MSFT 所说,将 vs 测试任务版本传递给 1 解决了这个问题。
但是当我仔细观察时,可用的测试平台版本是 2015 和 2013:
当我选择 VS 测试任务 版本 2 时,我有这些选择:
我想继续使用 vs 测试任务版本 2(以防将来更新,我不想被卡住...)。我看到的是当我将测试平台版本设置为“Latest”或“Visual Studio 2017”时,它不会工作。当我选择“Visual Studio 2015”时,它工作...
所以我的观点是:
- 将 vs 测试任务版本设置为 版本 1 使其工作(可能是因为最新的测试平台版本是“Visual Studio 2015"...?)
- 将 vs 测试任务版本设置为版本 2 并将 测试平台版本设置为"Visual Studio 2015" 使其工作
所以:
- 设置为 版本 1 的 VS 测试任务版本似乎与设置为 版本 2 的 VS 测试任务版本的工作方式相同"Test platform version" 设置为“Visual Studio 2015”。
- 如何让它与设置为 版本 2 的 VS 测试任务版本和设置为“最新[=103] 的 "Test platform version" 一起工作=]"?
编辑 3
远程连接到我的构建代理的服务器并从 VS2017 进行 运行 测试后,我将主机服务器的 Visual Studio 2017 的输出与本地 [=157= 的输出进行比较] 2017:
- 本地 Visual Studio 2017:
- 远程 Visual Studio 2017:
主机上的 "xUnit.net VSTest Adapter v2.4.0 (32-bit Universal Windows)" 是否存在一些问题?
我遇到了同样的问题并通过将 "Path to custom test adapters" 设置为 "Source\packages\xunit.runner.visualstudio.2.4.0\build_common" 来专门指向正确的测试适配器来解决它。 (您应该修改路径以说明 packages 文件夹在您的存储库中的位置。)
这显然是因为默认情况下 VSTS 会尝试提供帮助并扫描整个工作目录结构以查找测试适配器并加载 所有,但 xUnit Visual Studio测试适配器 Nuget 包也为 .Net Core 和 UWP 安装测试适配器,所以 VSTS 很乐意加载它们,然后它们就崩溃了。
当我运行在 VSTS 构建上进行单元测试时,我遇到了一个问题。 当我在本地 Visual Studio 上启动所有测试时,一切正常。完全没有错误。完美的。 但是当我通过 VSTS 构建上的测试任务启动我的测试时,出现此错误:
An exception occurred while invoking executor 'executor://xunit/VsTestRunner2/uap': Could not load file or assembly 'System.IO.FileSystem, Version=4.0.1.0, Culture=neutral, PublicKeyToken=***********' or one of its dependencies. The system cannot find the file specified.
我的测试项目是这样设置的:
"xunit.runner.visualstudio" 在版本 2.4.0 上 "targetFramework" 设置为 "net462"(在 packages.config 内设置)
.NET Framework 4.6.2
在我的构建服务器上:
Visual Studio 2017, v15.7.5
Visual Studio 2015, v14.0
我运行找不到线索了……我肯定漏掉了什么…… 感谢您的帮助
PS:
- 在 VSTS 构建中正确通过了所有测试
- 在我的构建任务的设置中,当我将 "Test platform version" 设置为 "Visual Studio 2015" 时,它起作用了。但是当我选择 "Visual Studio 2017" 或 "Latest" 我有同样的错误...
编辑
我有 Nuget 包 "FluentAssertions" v5.4.1 和 "System.ValueTuple" v4.5.0。我已经尝试降级其中一个和两个。它失败了。但是我看到 "FluentAssertions" 依赖于 "System.ValueTuple"
编辑 2
正如@PatrickLu-MSFT 所说,将 vs 测试任务版本传递给 1 解决了这个问题。 但是当我仔细观察时,可用的测试平台版本是 2015 和 2013:
当我选择 VS 测试任务 版本 2 时,我有这些选择:
我想继续使用 vs 测试任务版本 2(以防将来更新,我不想被卡住...)。我看到的是当我将测试平台版本设置为“Latest”或“Visual Studio 2017”时,它不会工作。当我选择“Visual Studio 2015”时,它工作... 所以我的观点是:
- 将 vs 测试任务版本设置为 版本 1 使其工作(可能是因为最新的测试平台版本是“Visual Studio 2015"...?)
- 将 vs 测试任务版本设置为版本 2 并将 测试平台版本设置为"Visual Studio 2015" 使其工作
所以:
- 设置为 版本 1 的 VS 测试任务版本似乎与设置为 版本 2 的 VS 测试任务版本的工作方式相同"Test platform version" 设置为“Visual Studio 2015”。
- 如何让它与设置为 版本 2 的 VS 测试任务版本和设置为“最新[=103] 的 "Test platform version" 一起工作=]"?
编辑 3
远程连接到我的构建代理的服务器并从 VS2017 进行 运行 测试后,我将主机服务器的 Visual Studio 2017 的输出与本地 [=157= 的输出进行比较] 2017:
- 本地 Visual Studio 2017:
- 远程 Visual Studio 2017:
主机上的 "xUnit.net VSTest Adapter v2.4.0 (32-bit Universal Windows)" 是否存在一些问题?
我遇到了同样的问题并通过将 "Path to custom test adapters" 设置为 "Source\packages\xunit.runner.visualstudio.2.4.0\build_common" 来专门指向正确的测试适配器来解决它。 (您应该修改路径以说明 packages 文件夹在您的存储库中的位置。)
这显然是因为默认情况下 VSTS 会尝试提供帮助并扫描整个工作目录结构以查找测试适配器并加载 所有,但 xUnit Visual Studio测试适配器 Nuget 包也为 .Net Core 和 UWP 安装测试适配器,所以 VSTS 很乐意加载它们,然后它们就崩溃了。