我在NUnit Core2.0项目中创建了.NET测试。我想在VSTS发行版中使用VsTest - TestAssemblies运行它们。当我在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。
发布于 2018-02-20 11:20:33
我遇到了同样的问题,并最终放弃了"VsTest - TestAssemblies“任务,因为我意识到有一个".NET核心”任务,可以将命令设置为测试。
在运行.NET Core2.0时,这将根据需要自动运行NuGet、恢复和构建。因此,运行用.NET核心项目编写的所有测试所需的唯一任务就是。
发布于 2018-03-27 12:10:37
我也遇到了同样的问题,但是在将System.Xml.XPath.XDocument NuGet包添加到测试项目之后,它就运行了。
发布于 2020-08-18 03:52:47
我也遇到了同样的问题,但是在我安装了最新和稳定版本的System.Xml.XPath.XmlDocument之后,问题就消失了。
https://stackoverflow.com/questions/48267470
复制相似问题