2

我在 .NET Core 2.0 项目中创建了 NUnit 测试。我想使用 VsTest - TestAssemblies将它们作为VSTS版本的一部分运行。当我在 VSTS 中为我​​的 DLL 运行此步骤时,我收到以下错误(或者更确切地说是警告),并且没有发现任何测试。当我在本地计算机上运行VsTest.console.exe时,相同的 DLL 可以工作。

2018-01-15T16:40:03.9599708Z Microsoft (R) Test Execution Command Line Tool Version 15.0.26929.2
2018-01-15T16:40:03.9600907Z Copyright (c) Microsoft Corporation.  All rights reserved.
2018-01-15T16:40:03.9602205Z 
2018-01-15T16:40:03.9861859Z vstest.console.exe 
2018-01-15T16:40:03.9862327Z "d:\a\r1\a\AutomationTest\drop\Tests\bin\Release\netcoreapp2.0\SecureApp.dll"
2018-01-15T16:40:03.9862517Z "d:\a\r1\a\drop\Tests\bin\Release\netcoreapp2.0\SecureApp.dll"
2018-01-15T16:40:03.9862856Z /logger:"trx"
2018-01-15T16:40:03.9862945Z /TestAdapterPath:"d:\a\r1\a"
2018-01-15T16:40:07.8106612Z Starting test execution, please wait...
2018-01-15T16:40:20.0035350Z Warning: Error initializing RunSettings. Default settings will be used
2018-01-15T16:40:20.0035696Z 
2018-01-15T16:40:21.4269527Z Warning: System.IO.FileNotFoundException: Could not load file or assembly 'System.Xml.XPath.XmlDocument, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
2018-01-15T16:40:21.4269844Z File name: 'System.Xml.XPath.XmlDocument, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
2018-01-15T16:40:21.4270026Z    at NUnit.VisualStudio.TestAdapter.AdapterSettings.Load(String settingsXml)
2018-01-15T16:40:21.4270199Z    at NUnit.VisualStudio.TestAdapter.AdapterSettings.Load(IDiscoveryContext context) in C:\Users\..\source\repos\nunit\nunit3-vs-adapter\src\NUnitTestAdapter\AdapterSettings.cs:line 168
2018-01-15T16:40:21.4270463Z    at NUnit.VisualStudio.TestAdapter.NUnitTestAdapter.Initialize(IDiscoveryContext context, IMessageLogger messageLogger) in C:\Users\..\source\repos\nunit\nunit3-vs-adapter\src\NUnitTestAdapter\NUnitTestAdapter.cs:line 122
2018-01-15T16:40:21.4270606Z 
2018-01-15T16:40:21.4270754Z WRN: Assembly binding logging is turned OFF.
2018-01-15T16:40:21.4270915Z To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
2018-01-15T16:40:21.4271067Z Note: There is some performance penalty associated with assembly bind failure logging.
2018-01-15T16:40:21.4271212Z To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
2018-01-15T16:40:21.4272472Z 
2018-01-15T16:40:21.4272556Z 
2018-01-15T16:40:21.4272665Z Information: NUnit Adapter 3.9.0.0: Test execution started
2018-01-15T16:40:21.4272742Z 
2018-01-15T16:40:21.4883313Z Warning: Exception System.IO.FileNotFoundException, Exception thrown executing tests
2018-01-15T16:40:21.4883790Z 
2018-01-15T16:40:21.4884316Z Warning: Could not load file or assembly 'System.Xml.XPath.XmlDocument, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
2018-01-15T16:40:21.4884557Z 
2018-01-15T16:40:21.4899528Z Warning:    at NUnit.VisualStudio.TestAdapter.NUnit3TestExecutor.RunAssembly(String assemblyPath, TestFilter filter)
2018-01-15T16:40:21.4900101Z    at NUnit.VisualStudio.TestAdapter.NUnit3TestExecutor.RunTests(IEnumerable`1 sources, IRunContext runContext, IFrameworkHandle frameworkHandle) in C:\Users\..\source\repos\nunit\nunit3-vs-adapter\src\NUnitTestAdapter\NUnit3TestExecutor.cs:line 98
2018-01-15T16:40:21.4900392Z 
2018-01-15T16:40:21.4915162Z Warning: Exception System.IO.FileNotFoundException, Exception thrown executing tests
2018-01-15T16:40:21.4915561Z 
2018-01-15T16:40:21.4915917Z Warning: Could not load file or assembly 'System.Xml.XPath.XmlDocument, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
2018-01-15T16:40:21.4916177Z 
2018-01-15T16:40:21.4916415Z Warning:    at NUnit.VisualStudio.TestAdapter.NUnit3TestExecutor.RunAssembly(String assemblyPath, TestFilter filter)
2018-01-15T16:40:21.4916739Z    at NUnit.VisualStudio.TestAdapter.NUnit3TestExecutor.RunTests(IEnumerable`1 sources, IRunContext runContext, IFrameworkHandle frameworkHandle) in C:\Users\..\source\repos\nunit\nunit3-vs-adapter\src\NUnitTestAdapter\NUnit3TestExecutor.cs:line 98
2018-01-15T16:40:21.4916960Z 
2018-01-15T16:40:21.4917196Z Information: NUnit Adapter 3.9.0.0: Test execution complete
2018-01-15T16:40:21.4917380Z 
2018-01-15T16:40:21.6170092Z Warning: No test is available in d:\a\r1\a\AutomationTest-.NET Desktop-CI\drop\Tests\bin\Release\netcoreapp2.0\SecureApp.dll d:\a\r1\a\drop\Tests\bin\Release\netcoreapp2.0\SecureApp.dll. Make sure that installed test discoverers & executors, platform & framework version settings are appropriate and try again.
2018-01-15T16:40:21.6171012Z 
2018-01-15T16:40:21.7226473Z 
2018-01-15T16:40:22.3665104Z Information: Additionally, you can try specifying '/UseVsixExtensions' command if the test discoverer & executor is installed on the machine as vsix extensions and your installation supports vsix extensions. Example: vstest.console.exe myTests.dll /UseVsixExtensions:true
2018-01-15T16:40:22.3665729Z 
2018-01-15T16:40:22.6599654Z ##[warning]No results found to publish.

为什么在我的本地机器上发现了xmlDocument.dll,但在 VSTS 上却没有?

在我的本地文件夹中,我也没有XmlDocument.dll

4

3 回答 3

1

我遇到了同样的问题,最终放弃了“VsTest - TestAssemblies”任务,因为我意识到有一个“.NET Core”任务可以将命令设置为测试。

运行 .NET Core 2.0 时,这将根据需要自动运行 NuGet 恢复和构建。所以真正需要运行所有在 .NET Core 项目中编写的测试的任务。

于 2018-02-20T11:20:33.810 回答
0

我遇到了同样的问题,但是在我安装了最新的稳定版本之后System.Xml.XPath.XmlDocument问题就消失了。

于 2020-08-18T03:52:47.213 回答
0

我遇到了同样的问题,但是在将 NuGet 包添加到测试项目后System.Xml.XPath.XDocument,它就运行了。

于 2018-03-27T12:10:37.917 回答