Forum Discussion
Failed Tests in DevOps Pipeline due to "could not find testhost"
This error message indicates that the test host required to run your tests is not found.
Here are some possible solutions to this issue:
Verify .NET Core version: Make sure that you have the correct version of .NET Core installed on your build machine. You can check the version by running the command "dotnet --version". If you have the incorrect version, you can install the correct version from the official .NET website.
Check the runtimeconfig.json file: Ensure that the testhost.runtimeconfig.json file exists in the expected location and that it specifies the correct .NET Core runtime version. If the file is missing, you can create it using the "dotnet new runtimeconfig" command.
Reinstall .NET Core runtime: If the problem persists, you can try reinstalling the .NET Core runtime on your build machine. You can download the latest version from the official .NET website and install it on your machine.
Update NuGet packages: Make sure that you have updated the NuGet packages in your solution to the latest version. Outdated packages can cause compatibility issues and result in this error.
Check the test project's dependencies: Ensure that all of the required dependencies for the test project are installed and referenced correctly. Check the project's .csproj file to make sure that all required packages are included in the project.
Delete bin and obj folders: Sometimes, deleting the bin and obj folders from your solution and rebuilding it can resolve the issue.
Try these solutions one by one until the error is resolved. If the problem still persists, you can check the diagnostic logs for more information and share it with the support team for further assistance.
- Tony_KiernanMay 02, 2023Copper Contributor
muhammadimran-dev wrote:Check the runtimeconfig.json file: Ensure that the testhost.runtimeconfig.json file exists in the expected location and that it specifies the correct .NET Core runtime version. If the file is missing, you can create it using the "dotnet new runtimeconfig" command.
How do I run this command in Azure devops? Thanks
- umashankarsharmaFeb 17, 2023Copper Contributor
Guess I used ChatGPT and looked at this result. I still think there is a way to go until it gives concrete answer rather then a generic response.
Thank you anyways.