Reputation: 87
Question:
I'm encountering issues running my MSTest tests on a build server using vstest.console.exe. My tests run perfectly fine locally, but on the build server, I get the following error:
Method not found: 'Void Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.TestSourceHost..ctor(System.String, Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter.IRunSettings)'
Setup Details:
Local Environment:
Visual Studio 2022
MSTest.TestAdapter version: 3.x.x.x
MSTest.TestFramework version: 3.x.x.x
Build Server Setup:
Running vstest.console.exe from a directory with a TestPlatform folder containing the necessary DLLs. Command Used:
TMockRunner.exe vstest.console.exe dllpath logtype:logpath
Errors and Attempts to Resolve: Error:
Method not found: 'Void Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.TestSourceHost..ctor(System.String, Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter.IRunSettings)'
Steps Taken:
Ensured MSTest packages are up to date in the .csproj file. Cleared NuGet cache using dotnet nuget locals all --clear. Verified that TestPlatform folder contains the expected DLLs. Attempted to run tests using dotnet test to handle dependencies automatically. Despite these steps, the error persists on the build server. I suspect there might be a version mismatch between the test adapters/frameworks in the project and those in the TestPlatform folder.
Questions: How can I ensure that the versions of MSTest.TestAdapter and MSTest.TestFramework match the ones expected by the TestPlatform folder? What are the best practices to avoid such conflicts when using vstest.console.exe outside of the Visual Studio install folder? Are there additional steps I should take to resolve this Method not found error? Any guidance or solutions would be greatly appreciated!
Upvotes: 0
Views: 65