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

4

7

I recently installed '.net 6 (SDK 6.0.302)' on build and deployment environments. Now these environments have following SDKs installed:

2.1.504 
2.1.510 
2.1.511 
2.1.518 
2.1.807 
2.1.810 
2.1.811 
3.1.108 
3.1.302 
3.1.414 
5.0.210 
6.0.302  (default)

And following runtimes installed:

-Microsoft.AspNetCore.All 2.1.8 
-Microsoft.AspNetCore.All 2.1.14 
-Microsoft.AspNetCore.All 2.1.15 
-Microsoft.AspNetCore.All 2.1.19 
-Microsoft.AspNetCore.All 2.1.22 
-Microsoft.AspNetCore.All 2.1.23 
-Microsoft.AspNetCore.App 2.1.8 
-Microsoft.AspNetCore.App 2.1.14 
-Microsoft.AspNetCore.App 2.1.15 
-Microsoft.AspNetCore.App 2.1.19 
-Microsoft.AspNetCore.App 2.1.22 
-Microsoft.AspNetCore.App 2.1.23 
-Microsoft.AspNetCore.App 3.1.6 
-Microsoft.AspNetCore.App 3.1.8 
-Microsoft.AspNetCore.App 3.1.20 
-Microsoft.AspNetCore.App 3.1.22 
-Microsoft.AspNetCore.App 3.1.26 
-Microsoft.AspNetCore.App 5.0.13 
-Microsoft.AspNetCore.App 6.0.6 
-Microsoft.NETCore.App 2.1.8 
-Microsoft.NETCore.App 2.1.14 
-Microsoft.NETCore.App 2.1.15 
-Microsoft.NETCore.App 2.1.19 
-Microsoft.NETCore.App 2.1.22 
-Microsoft.NETCore.App 2.1.23 
-Microsoft.NETCore.App 3.1.6 
-Microsoft.NETCore.App 3.1.8 
-Microsoft.NETCore.App 3.1.20 
-Microsoft.NETCore.App 3.1.22 
-Microsoft.NETCore.App 3.1.26 
-Microsoft.NETCore.App 5.0.13 
-Microsoft.NETCore.App 6.0.6 
-Microsoft.WindowsDesktop.App 3.1.6 
-Microsoft.WindowsDesktop.App 3.1.8 
-Microsoft.WindowsDesktop.App 3.1.20 
-Microsoft.WindowsDesktop.App 3.1.22 
-Microsoft.WindowsDesktop.App 5.0.13 
-Microsoft.WindowsDesktop.App 6.0.6 

For now all the projects are targeting '.net 3.1' .

And just after the install of '.net 6' , projects are complaining at random during build/test/runtime.

With following error:

   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.

Any idea, on how what caused this issue.

Thanks in Advance

Cheetah answered 20/7, 2022 at 18:17 Comment(1)
I am also getting this error. Nothing changed on my machine, my CIs just broke off. Is Microsoft somehow enforcing the use of specific Framework versions? It was working fine with 3.1.26Blarney
A
1

I resolved this error message by upgrading my NuGet packages within my solution that still relied on .NetCore 3.1.

Ambidexterity answered 15/1, 2023 at 11:37 Comment(1)
thanks for sharing your experience , i again faced similar issue down the line , and it seems nuget package update is the way to goCheetah
D
5

in the project_name.csproj file change the old donet version

<TargetFramework>net5.0</TargetFramework>

to the newest one

   <TargetFramework>net6.0</TargetFramework>

just replace 5 with 6

it will run efficiently

Diaphoretic answered 13/9, 2022 at 17:14 Comment(0)
E
2

Below solution is working for me.

Please open Preferences (File - > Settings) -> Build, Execution, Deployment -> Toolset and Build -> .NET Core CLI executable path and select path to x64 dotnet - /usr/local/share/dotnet/x64/dotnet

Eulaliaeulaliah answered 15/5, 2023 at 8:40 Comment(0)
A
1

I resolved this error message by upgrading my NuGet packages within my solution that still relied on .NetCore 3.1.

Ambidexterity answered 15/1, 2023 at 11:37 Comment(1)
thanks for sharing your experience , i again faced similar issue down the line , and it seems nuget package update is the way to goCheetah
P
0

It's definitely because you have added the Nuget package Microsoft.AspNetCore.App of version 3.1.27 that isn't compatible with .NET 6 - it literally tells you in that error message you posted:

error Framework: 'Microsoft.AspNetCore.App', version '3.1.27' (x64)

If I try and add Microsoft.AspNetCore.App into my .NET6 project, the latest stable version that Nuget offers me is 2.2.8. I'm not 100% sure what version of .NET package v3.1.27 is for, but I'm guessing probably for .NET7 or later.

Processional answered 14/8, 2023 at 3:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.