Skip to content

.NET Runtime Not Found Error Fix

DodaTech Updated 2026-06-24 3 min read

In this tutorial, you'll learn about .net runtime not found error fix. We cover key concepts, practical examples, and best practices.

The Problem

Running your .NET application fails with:

It was not possible to find any installed .NET runtime.
Did you mean to run .NET SDK commands? Please install a runtime from https://dotnet.microsoft.com/download

The published app requires a specific .NET runtime version that is not installed on the target machine.

Quick Fix

Step 1: Check installed runtimes

WRONG -- guessing which runtime is installed:

dotnet --list-runtimes

RIGHT -- check both runtimes and SDKs:

dotnet --info

Look for the Microsoft.NETCore.App version that matches your project's TargetFramework.

Step 2: Install the required runtime

WRONG -- installing the latest runtime instead of the required one:

sudo apt install dotnet-runtime-9.0  # may not match your target

RIGHT -- match the version exactly:

# For .NET 8.0 app
sudo apt install dotnet-runtime-8.0

Or use the install script:

curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel 8.0 --runtime

Step 3: Configure roll-forward policy

WRONG -- assuming the app will automatically use a newer runtime:

<PropertyGroup>
  <TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

RIGHT -- set RollForward to enable using a newer runtime:

<PropertyGroup>
  <TargetFramework>net8.0</TargetFramework>
  <RollForward>LatestMajor</RollForward>
</PropertyGroup>

Or specify at runtime:

DOTNET_ROLL_FORWARD=LatestMajor ./MyApp

Step 4: Use self-contained deployment

WRONG -- publishing as framework-dependent to a machine without the runtime:

dotnet publish -c Release

RIGHT -- publish self-contained with the runtime included:

dotnet publish -c Release --self-contained true -r linux-x64

This bundles the runtime with your app, increasing size but removing the dependency.

Step 5: Check the .runtimeconfig.json

WRONG -- incorrect runtime config:

{
  "runtimeOptions": {
    "tfm": "net8.0",
    "framework": {
      "name": "Microsoft.NETCore.App",
      "version": "8.0.0"
    }
  }
}

RIGHT -- allow roll-forward in the config:

{
  "runtimeOptions": {
    "tfm": "net8.0",
    "rollForward": "LatestMajor",
    "framework": {
      "name": "Microsoft.NETCore.App",
      "version": "8.0.0"
    }
  }
}

Prevention

  • Install the .NET runtime using a configuration management tool (Ansible, DSC) on target machines.
  • Use self-contained publish for applications deployed to machines you do not control.
  • Set RollForward in the project file to handle minor version differences.
  • Test deployments in a clean environment (Docker container) before production.
  • Include runtime detection in your application startup.

Common Mistakes with runtime not found

  1. Placing the wildcard pattern first in case expressions, making all subsequent patterns unreachable
  2. Using head and tail instead of pattern matching, causing runtime errors on empty lists
  3. Forgetting that lazy evaluation defers computation until the value is forced, causing space leaks with unevaluated thunks

These mistakes appear frequently in real-world DOTNET code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.

Practice Exercise

Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.

FAQ

### What is the difference between `dotnet --list-runtimes` and `dotnet --list-sdks`?

--list-runtimes shows installed runtime versions needed to run published apps. --list-sdks shows the SDK versions used for building. You need the SDK to build and the runtime to run.

Why does the app work on my dev machine but not on the server?

Your dev machine has the .NET SDK installed, which includes the runtime. The server likely only has the runtime, possibly a different version. Use dotnet --info on both machines to compare.

How much larger is a self-contained deployment?

A self-contained publish adds approximately 30-60 MB depending on the .NET version and target platform. Individual files can be trimmed using the assembly linker or published as trimmed builds.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro