[InnoSetup] Prevent install if newer version is already installed
check-version.iss
Inno Setup is a free script-driven installation system software for. Your installer can check if the user already installed your app and if found,. In the Code section, we now define the functions that check for the.NET version installed. This code is directly taken from Jordan Russell's site. The setup will copy the.NET installer file (which is a smart file of about 850 KB), only if is not already present in the. I found it very helpful. I will look through Inno's setup.
#define AppId '{INSERT HERE YOUR GUID}' |
#define AppName 'My App' |
#define AppVersion '1.7' |
[CustomMessages] |
english.NewerVersionExists=A newer version of {#AppName} is already installed.%n%nInstaller version: {#AppVersion}%nCurrent version: |
[Code] |
// find current version before installation |
functionInitializeSetup: Boolean; |
var Version: String; |
begin |
if RegValueExists(HKEY_LOCAL_MACHINE,'SoftwareMicrosoftWindowsCurrentVersionUninstall{#AppId}_is1', 'DisplayVersion') then |
begin |
RegQueryStringValue(HKEY_LOCAL_MACHINE,'SoftwareMicrosoftWindowsCurrentVersionUninstall{#AppId}_is1', 'DisplayVersion', Version); |
if Version > '{#AppVersion}'then |
begin |
MsgBox(ExpandConstant('{cm:NewerVersionExists} '+Version), mbInformation, MB_OK); |
Result := False; |
end |
else |
begin |
Result := True; |
end |
end |
else |
begin |
Result := True; |
end |
end; |
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment
Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upHave a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
commented Jun 20, 2019
For .Net frameworks it could be done easily by RegQueryDWordValue(HKLM, 'SoftwareMicrosoftNET Framework SetupNDPv4Full', 'Release', regVersion); How to check the same for .NET Core ? |
commented Jun 25, 2019
@dagood seems to be related to install/setup. Is it possible to check the .NET Core installation in the registry? |
commented Jun 26, 2019
Yeah, here are a couple previous discussions: dotnet/core-setup#4904 mentions the plans for a registry key for 3.0, install-locations.md. dotnet/core-setup#3381 is a bit old, but I still see recent versions in my registry where it mentions them: HKLMSOFTWAREWOW6432NodedotnetSetupInstalledVersionsx64sharedfxMicrosoft.NETCore.App Note that that path is for shared frameworks (runtimes), rather than SDK installs. The SDK keys are around the same place. I don't know of any official docs describing this, though. (Other than the source code, I suppose. If you have any more questions about the runtime installers, feel free to ask in https://github.com/dotnet/core-setup directly. |
commented Jul 9, 2019
Closing since the question seems to be answered. |
closed this Jul 9, 2019
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment