2

I did a prototype console web project (Minimal APIs) some 5 months ago in Visual Studio 2022 and now I want to restart work on it. However, when I try to run the .exe, I get the following message.

It was not possible to find any compatible framework version The framework 'Microsoft.NETCore.App', version '6.0.6' (x86) was not found.

  • The following frameworks were found:
    • 5.0.12 at [C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
    • 5.0.17 at [C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
    • 6.0.0 at [C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]

You can resolve the problem by installing the specified framework and/or SDK.

If I try to debug it from VS, I get the message

The target process exited without raising a CoreCLR started event. Ensure that the target process is configured to use .NET Core. This may be expected if the target process did not run on .NET Core. The program '[30812] TodoApi.exe' has exited with code 2147516566 (0x80008096).

Now, I know that I can just install the new runtime and be done with it, but I don't understand why I'm forced to upgrade the runtime in an otherwise unchanged project. I haven't updated Visual Studio 2022 in that time either.

If I just straight upgrade, then it can happen again in the future, and I would like to know why.

The .csproj is

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>net6.0-windows</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
    <PlatformTarget>x86</PlatformTarget>
    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
    <Platforms>AnyCPU;x64</Platforms>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
  </ItemGroup>

</Project>

Project Configuration

No idea what other information could be relevant, sorry.

Edit: I thought about adding dotnet --info output, and now I see .NET 6.0.6 in host, which I guess is the problem?

.NET SDK (reflecting any global.json):
 Version:   6.0.106
 Commit:    e83a22f558

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19043
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\6.0.106\

Host (useful for support):
  Version: 6.0.6
  Commit:  7cca709db2

.NET SDKs installed:
  6.0.100 [C:\Program Files\dotnet\sdk]
  6.0.106 [C:\Program Files\dotnet\sdk]

I guess it was a Windows update? How do I turn it back to 6.0.1? I do not have a global.json file.

4
  • check for global.json file - maybe it is present in the root folder? Commented Jun 21, 2022 at 16:32
  • Hi @GuruStron I did a full drive search and did not find a global.json file. It seems that when there is no global.json, .NET defaults to the lastest version. Commented Jun 21, 2022 at 17:07
  • have you checked the value of the "target framework" dropdown in the Visual Studio UI? It is set to "x86"? (Next to the dropdown with "debug" and "release") Commented Jul 15 at 9:56
  • I've had issues with .NET versions that are past end-of-support 'disappearing' due to Windows Update or security scan. Note that .NET 6.0 support ended 11/2024 (learn.microsoft.com/en-us/lifecycle/products/…). One solution is to upgrade to .NET 8, 9, or 10 and then stay current. Commented Jul 15 at 12:29

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.