Can I run a .NET 6.0 service with .NET 8.0 runtime?

59 Views Asked by At

I developed a .NET 6.0 app. The computer (raspberry 3) where this service will run has .NET 8.0 runtime.

When I try to run the application with dotnet service.dll, this message appears:

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

App: /home/stationpi/Rpi3Gateway/RpiGateway.dll
Architecture: arm
Framework: 'Microsoft.NETCore.App', version '6.0.0' (arm)
.NET location: /opt/dotnet/

The following frameworks were found:
8.0.3 at [/opt/dotnet/shared/Microsoft.NETCore.App]

Learn more:
https://aka.ms/dotnet/app-launch-failed

To install missing framework, download:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=6.0.0&arch=arm&rid=linux-arm&os=raspbian.11

I can't run services developed in previous version of .NET Core?

Obs: the strangest thing is that when I published the same code for linux-arm64 (raspberry 4), this problem didn't happen

2

There are 2 best solutions below

0
FelipeFonsecabh On

I understood my mistake. In the linux-arm64 publish settings I selected the "Deployment mode" option as "Self-Contained".

When I created another profile, I set this option to "Framework-dependent", which is why when running, it questioned version 6.0.0 of dotnet core.

0
Bhavesh Jha On

if you are talking about dotnet core then you can run the services of .Net 6.0 with .Net 8.0 you just have to install the .Net 8.0 necessary SDK and after that follow these steps:

  1. find bin and obj folder in the project directory.
  2. delete the both folder bin and obj.
  3. run the command dotnet clean and dotnet build in your VScode if your using another IDE then clean and build your project accordingly.
  4. run the project by dotnet run command if any issue persist then run the code in debug mode and resolve it accordingly.