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 AppPublisher "LowPoly Games"
#define AppVersion GetFileVersion("..\bin\Release\net5.0-windows\LPG Launcher.exe")
#define AppEXEName "LPG Launcher.exe"
#define AppURL "https://lowpolygames.itch.io/"
#define AppIcon "Resources\LogoTemp.ico"
[Setup]
AppId={{1c2dga42-g5s6-10d3-af3g-9bv3nf9ewj34}
ArchitecturesInstallIn64BitMode=x64
ArchitecturesAllowed=x64
AppName={#AppName}
AppVerName={#AppName} {#AppVersion}
AppVersion={#AppVersion}
AppPublisher={#AppPublisher}
AppPublisherURL={#AppURL}
DefaultDirName={pf}\LowPoly Games\{#AppName}
DefaultGroupName={#AppPublisher}
Compression=lzma2
SolidCompression=yes
OutputBaseFilename=LPG Launcher Installer {#AppVersion}
SetupIconFile={#AppIcon}
OutputDir=..\Output
[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...