You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Agent - Private, OS: Windows Server 2016 Standard, agent version: 2.181.2
Issue Description
We have a .NET 6 test project with both XUnit tests and Mocha tests. The Mocha tests are set up as described in https://docs.microsoft.com/en-us/visualstudio/javascript/unit-testing-javascript-with-visual-studio?view=vs-2022&tabs=mocha.
We get the error: An exception occurred while invoking executor 'executor://nodejstestexecutor/v1': Could not load file or assembly 'Microsoft.Build, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified when running the Mocha tests in VsTask using the Visual Studio Test Platform Installer (Test platform version = Installed by Tools Installer).
The Mocha tests run successful when using VsTask with a specific location for vstest.console.exe, namely the executable in the VS2022-folder (...\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe).
Troubleshooting
We are enable to reproduce the issue using the VS2022 Developer command prompt.
First using vstest.console from VS2022:
Using vstest.console gotten from task Visual Studio Test Platform installer:
Task logs
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
An exception occurred while invoking executor 'executor://nodejstestexecutor/v1': Could not load file or assembly 'Microsoft.Build, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
Stack trace:
at Microsoft.NodejsTools.TestAdapter.ProjectTestDiscoverer.DiscoverTestsCore(IEnumerable`1 sources, IMessageLogger logger, ITestCaseDiscoverySink discoverySink)
at Microsoft.NodejsTools.TestAdapter.ProjectTestDiscoverer.DiscoverTests(IEnumerable`1 sources, IDiscoveryContext discoveryContext, IMessageLogger logger, ITestCaseDiscoverySink discoverySink)
at Microsoft.NodejsTools.TestAdapter.TestExecutorWorker.RunTests(IEnumerable`1 sources, ITestDiscoverer discoverer)
at Microsoft.NodejsTools.TestAdapter.ProjectTestExecutor.RunTests(IEnumerable`1 sources, IRunContext runContext, IFrameworkHandle frameworkHandle)
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.RunTestsWithSources.InvokeExecutor(LazyExtension`2 executor, Tuple`2 executorUriExtensionTuple, RunContext runContext, IFrameworkHandle frameworkHandle)
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.BaseRunTests.<>c__DisplayClass48_0.b__0()
at Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformThread.<>c__DisplayClass0_0.b__0()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformThread.Run(Action action, PlatformApartmentState apartmentState, Boolean waitForCompletion)
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.BaseRunTests.TryToRunInSTAThread(Action action, Boolean waitForCompletion)
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.BaseRunTests.RunTestInternalWithExecutors(IEnumerable`1 executorUriExtensionMap, Int64 totalTests)
Test Run Failed.
The text was updated successfully, but these errors were encountered:
This issue is stale because it has been open for 180 days with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days
Required Information
Question, Bug, or Feature?
Bug
Enter Task Name: VsTest (Visual Studio Test)
Environment
Issue Description
We have a .NET 6 test project with both XUnit tests and Mocha tests. The Mocha tests are set up as described in https://docs.microsoft.com/en-us/visualstudio/javascript/unit-testing-javascript-with-visual-studio?view=vs-2022&tabs=mocha.
We get the error:
An exception occurred while invoking executor 'executor://nodejstestexecutor/v1': Could not load file or assembly 'Microsoft.Build, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified
when running the Mocha tests in VsTask using the Visual Studio Test Platform Installer (Test platform version = Installed by Tools Installer).The Mocha tests run successful when using VsTask with a specific location for vstest.console.exe, namely the executable in the VS2022-folder (...\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe).
Troubleshooting
We are enable to reproduce the issue using the VS2022 Developer command prompt.
First using vstest.console from VS2022:
Using vstest.console gotten from task Visual Studio Test Platform installer:
Task logs
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
An exception occurred while invoking executor 'executor://nodejstestexecutor/v1': Could not load file or assembly 'Microsoft.Build, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
Stack trace:
at Microsoft.NodejsTools.TestAdapter.ProjectTestDiscoverer.DiscoverTestsCore(IEnumerable`1 sources, IMessageLogger logger, ITestCaseDiscoverySink discoverySink)
at Microsoft.NodejsTools.TestAdapter.ProjectTestDiscoverer.DiscoverTests(IEnumerable`1 sources, IDiscoveryContext discoveryContext, IMessageLogger logger, ITestCaseDiscoverySink discoverySink)
at Microsoft.NodejsTools.TestAdapter.TestExecutorWorker.RunTests(IEnumerable`1 sources, ITestDiscoverer discoverer)
at Microsoft.NodejsTools.TestAdapter.ProjectTestExecutor.RunTests(IEnumerable`1 sources, IRunContext runContext, IFrameworkHandle frameworkHandle)
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.RunTestsWithSources.InvokeExecutor(LazyExtension`2 executor, Tuple`2 executorUriExtensionTuple, RunContext runContext, IFrameworkHandle frameworkHandle)
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.BaseRunTests.<>c__DisplayClass48_0.b__0()
at Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformThread.<>c__DisplayClass0_0.b__0()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformThread.Run(Action action, PlatformApartmentState apartmentState, Boolean waitForCompletion)
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.BaseRunTests.TryToRunInSTAThread(Action action, Boolean waitForCompletion)
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.BaseRunTests.RunTestInternalWithExecutors(IEnumerable`1 executorUriExtensionMap, Int64 totalTests)
Test Run Failed.
The text was updated successfully, but these errors were encountered: