Reputation: 21
I created NUnit tests in .NET Core 2.0 project. I want to run them as part of VSTS release using VsTest - TestAssemblies. When I run this step for my DLL in VSTS, I am getting the following error (or rather warnings), and no tests are being discovered. The same DLL works when I run VsTest.console.exe on my local machine.
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.
Why is xmlDocument.dll discovered on my local machine, but not on VSTS?
In my local folder I don't have XmlDocument.dll either.
Upvotes: 2
Views: 840
Reputation: 135
I had the same problem but after I installed the latest and the stable version of System.Xml.XPath.XmlDocument
problem went away.
Upvotes: 0
Reputation: 722
I had the same problem but, after adding to the test project the System.Xml.XPath.XDocument
NuGet package, it just ran.
Upvotes: 0
Reputation: 66
I had the same issue and ended up dropping the "VsTest - TestAssemblies" task as I realized there's a ".NET Core" task where the command can be set to test.
When running .NET Core 2.0 this will auto run NuGet restore and build as needed. So really the only task needed to run all tests written in .NET Core projects.
Upvotes: 1