Search code examples
.net.net-coreconsoleconsole-application

.net console app how to check required runtime for itself at startup


  • I developed a console app based on .net 8.0,
  • then I deliver the .exe (without runtime inside) to user,
  • but I am not sure if the user have installed the .net 8.0 runtime to support this app, how could I make the .exe to run to check that, even user did not install the runtime
  • (the app start and check the runtime, if the runtime was not installed, it show the runtime download website and stop/hold)
  • or any other way to do it

Solution

  • You could use the options "PublishSingleFile" and "SelfContained", so that the whole framework will be compiled into your single *.exe file. Then you don´t have to check if the framework is installed.