"You must install .NET Desktop Runtime to run this application"

11.3k views Asked by At

I make a Desktop application Form using C# and .NET. Then I simply deploy it and make a .EXE file of it. But when I runt his .EXE file on my other Laptop, it is going to ask me "You must install .NET Desktop Runtime to run this application".

2

There are 2 answers

0
Augusto César Bisognin On

Well, you'need to install .Net Desktop Runtime ‍♂️

You can download it from here, just look for the "Desktop runtime" section. This link is for version 6.0, so maybe I'll need to look for a different version.

2
mike On

Well, if you wanted to use the app on another device without installing the .NET Desktop Runtime, you could've just created a self-contained app by opening the project folder that has the .csproj file in cmd or powershell and you could've ran:

  1. this command to publish it in the "Debug" folder
dotnet publish -r win-x64 --self-contained true -c Debug
  1. or this one for the "Release" folder
dotnet publish -r win-x64 --self-contained true -c Release

The -r flag is used to set the runtime id, for which you can see the catalog here. The -c flag is used to set the configuration: Release or Debug.

To learn more about the dotnet publish command, you can read this article on Microsoft Docs

Or you could've installed the.NET Desktop Runtime on your other laptop like Augusto said in his answer