I have the following .iss script to compile a games launcher I'm working on that uses .NET 5.0. Currently it tries to install .NET 5.0 from the installer it has every time instead of checking if its required first. I've found plenty of resources that tell you how to do it for the .NET Framework but hardly anything for .NET 5.0 which is a updated version of .NET Core. How do I check if .NET 5.0 is already installed before trying to install it anyway?
I also am aware that 5.0 is nearer end of life but I'm using Visual Studio 2019 which 6.0 isn't compatible with and would prefer not to have to use any work arounds to get 2019 to play ball with it.
#define AppName "LowPoly Games Launcher"
#define AppEXEName "LPG Launcher.exe"
[Setup]
AppName={#AppName}
[Files]
Source: "..\bin\Release\net5.0-windows\*"; DestDir: "{app}"; \
Flags: ignoreversion recursesubdirs;
Source: "Resources\windowsdesktop-runtime-5.0.17-win-x64.exe"; \
DestDir: "{app}"; Flags: ignoreversion deleteafterinstall
[Run]
Filename: "{app}\{#AppEXEName}"; \
Description: "{cm:LaunchProgram, {#StringChange(AppName, '&', '&&')}}"; \
Flags: nowait postinstall
Filename: "{app}\windowsdesktop-runtime-5.0.17-win-x64.exe"; \
Parameters: "/q/passive"; Flags: waituntilterminated; \
StatusMsg: Microsoft .NET Framework 5.0 is being installed. Please wait...