Testhost process exited with error: You must install or update .NET to run this application.

Ajai Singh 11 Reputation points
2022-07-18T08:05:31.503+00:00

Hello,

I am facing below error while running a test on build server .

build Microsoft (R) Test Execution Command Line Tool Version 17.2.0 (x64)
build Copyright (c) Microsoft Corporation. All rights reserved.

Starting test execution, please wait...
build A total of 1 test files matched the specified pattern.
error Testhost process exited with error: You must install or update .NET to run this application.
error App: C:\Users\bamboo.nuget\packages\microsoft.testplatform.testhost\15.9.0\lib\netstandard1.5\testhost.dll
error Architecture: x64
error Framework: 'Microsoft.AspNetCore.App', version '3.1.27' (x64)
error .NET location: C:\Program Files\dotnet\
error The following frameworks were found:
error 2.1.8 at [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
error 2.1.14 at [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
error 2.1.15 at [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
error 2.1.19 at [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
error 2.1.22 at [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
error 2.1.23 at [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
error 3.1.6 at [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
error 3.1.8 at [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
error 3.1.20 at [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
error 3.1.22 at [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
error 3.1.26 at [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
error 5.0.13 at [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
error 6.0.7 at [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
error Learn about framework resolution:
error https://aka.ms/dotnet/app-launch-failed
error To install missing framework, download:
error https://aka.ms/dotnet-core-applaunch?framework=Microsoft.AspNetCore.App&framework_version=3.1.27&arch=x64&rid=win10-x64
error . Please check the diagnostic logs for more information.

Even though setting are as follows:

<TargetFramework>netcoreapp3.1</TargetFramework>
<ItemGroup>
<PackageReference Include="DeepEqual" Version="2.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="Moq" Version="4.13.1" />
<PackageReference Include="System.Text.Encodings.Web" Version="5.0.1" />
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" PrivateAssets="all" />
</ItemGroup>

How come test runner is looking for framework_version=3.1.27 .

Can someone please help me understand the issue

Thanks

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,648 questions
Visual Studio Testing
Visual Studio Testing
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Testing: The act or process of applying tests as a means of analysis or diagnosis.
338 questions
Not Monitored
Not Monitored
Tag not monitored by Microsoft.
37,798 questions
{count} votes