question

KiranKumarNatarajan-6758 avatar image
0 Votes"
KiranKumarNatarajan-6758 asked Bruce-SqlWork answered

How to make exe built on .NET Core 3.1 run on a system with .NET 6 runtime?

I have a Desktop application which has TargetFramework in the csproj file as netcoreapp3.1
One of our new customer has installed .NET 6 runtime.
When trying to install the application, the customer is getting a prompt to install .NET Core 3.1 to continue the installation.
Is there a way that allows the user to install the app with just .NET 6 runtime installed?
I prefer not to modify the csproj file to add .NET 6 to the TargetFrameworks list as this will require new installers to be created.

dotnet-runtimewindows-10-application-compatibility
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Bruce-SqlWork avatar image
0 Votes"
Bruce-SqlWork answered

.net core apps only run on the framework version they were built with. You can do a self contained deployment that included the runtime so no additional runtimes need to be installed.

So if you rebuild your app to .net 6, it will only run on .net 6.

If build a multi target applications you will get a different binary for each framework, so your installer would need to ask which to install.

Might make more sense to have a separate installer for each framework you want to support.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

JaliyaUdagedara avatar image
0 Votes"
JaliyaUdagedara answered

It seems you have used the framework-dependent deployment model. That is the app doesn't include the .NET runtime instead the required .NET runtime needs to be pre-installed in order for the app to run.

Unfortunately, I don't think you can run the app without installing .NET Core 3.x runtime. (Refer: Framework-dependent apps roll-forward)

I would suggest using self-contained deployment model, so you won't face this situation in the future.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

LimitlessTechnology-2700 avatar image
0 Votes"
LimitlessTechnology-2700 answered

Hi @KiranKumarNatarajan-6758

In this case it will be needed to be changed or adding .NET 6 to accept as target. The main reason is that besides including previous versions, files updates, etc... the issue is that when installed the .NET install leaves registry information and other classes with the Framerwork version installed. Since your app targets specifically 3.1, and 6 doesn't equal the requirement expected, the application will still prompt the requirement.

Hope this helps with your query,


--If the reply is helpful, please Upvote and Accept as answer--

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.