skip to Main Content

Trying to run a dotnet core based docker container on a windows 2022 server that’s setup with WSL2 (Ubuntu). Running the container fails with the below error message indicating I don’t have any dotnet frameworks installed…

You must install or update .NET to run this application.

App: /app/TodoApi.dll
Architecture: x64
Framework: 'Microsoft.AspNetCore.App', version '6.0.0' (x64)
.NET location: /usr/share/dotnet/

No frameworks were found.
https://aka.ms/dotnet/app-launch-failed

To install missing framework, download:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.AspNetCore.App&framework_version=6.0.0&arch=x64&rid=debian.11-x64

Running dotnet --info I can see I have version sdk - 6.0.400, runtime - 6.0.8

azureuser@myworkstation01:/mnt/c/Users/azureuser$ dotnet --info
.NET SDK (reflecting any global.json):
 Version:   6.0.400
 Commit:    7771abd614

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  20.04
 OS Platform: Linux
 RID:         ubuntu.20.04-x64
 Base Path:   /usr/share/dotnet/sdk/6.0.400/

global.json file:
  Not found

Host:
  Version:      6.0.8
  Architecture: x64
  Commit:       55fb7ef977

.NET SDKs installed:
  6.0.400 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.8 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.8 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Checking in $PATH, i can see there is an environment variable for dotnet already…

azureuser@myworkstation01:/mnt/c/Users/azureuser$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Windows/system32:/mnt/c/Windows:/mnt/c/Windows/System32/Wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0/:/mnt/c/Windows/System32/OpenSSH/:/mnt/c/Program Files/dotnet/:/mnt/c/Program Files (x86)/dotnet/:/mnt/c/Program Files/Docker/Docker/resources/bin:/mnt/c/ProgramData/DockerDesktop/version-bin:/mnt/c/ProgramData/chocolatey/bin:/mnt/c/Program Files/PowerShell/7/:/mnt/c/Users/azureuser/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/azureuser/AppData/Local/Programs/Microsoft VS Code/bin:/mnt/c/Users/azureuser/.dotnet/tools:/snap/bin:/home/azureuser/.dotnet/tools

I am using WSL2, I can see Docker is configured to use Ubuntu distro in the WSL integration.

enter image description here

I’ve config RollForward to LatestMajor in my dotnet core project property…

Is there anything obvious I am missing?

2

Answers


  1. Chosen as BEST ANSWER

    The WSL2 led me down a rabbithole. The issue was in the docker file itself, my baseimage didn't have the right aspnet core framework. This has been resolved using the following stackoverflow answer - The framework 'Microsoft.AspNetCore.App', version '6.0.0' (x64) was not found

    Check for Project tag of .csproj file. If it's Sdk attribute is set to Microsoft.NET.Sdk.Web then this would be a reason for ASP.NET Core runtime requirement. Also check for libraries referencing Microsoft.AspNetCore.App.


  2. I upgraded ubuntu and had the same problem.
    Try uninstalling dotnet and specifying the version you want to install.

    Github Reference

    $ sudo apt install aspnetcore-runtime-6.0=6.0.8-1 dotnet-apphost-pack-6.0=6.0.8-1 dotnet-host=6.0.8-1 dotnet-hostfxr-6.0=6.0.8-1 dotnet-runtime-6.0=6.0.8-1 dotnet-sdk-6.0=6.0.400-1 dotnet-targeting-pack-6.0=6.0.8-1
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search