False-positive missing .NET 4.8 framework

96 views
Skip to first unread message

Info

unread,
Apr 9, 2024, 2:16:29 PMApr 9
to inno...@googlegroups.com
I have a system, on which I need to install an app from my InnoSetup
package. It includes the following check:

var
  DownloadPage: TDownloadWizardPage;
  IsDotNet: boolean;

procedure InitializeWizard;
begin
  DownloadPage := CreateDownloadPage('Download of .NET framework is
requried', '.NET framework 4.8 is missing from your system and has to be
downloaded and installed.', @OnDlProgress);
end;

function NextButtonClick(CurPageID: Integer): Boolean;
begin
  if ((IsDotNet = false) and (CurPageID = wpReady)) then
  begin
    DownloadPage.Clear;
DownloadPage.Add('https://go.microsoft.com/fwlink/?linkid=2088631',
'ndp48-x86-x64-allos-enu.exe', '');
    DownloadPage.Show;
    try
      try
        DownloadPage.Download;
        Result := True;
      except
SuppressibleMsgBox(AddPeriod(GetExceptionMessage), mbCriticalError,
MB_OK, IDOK);
        Result := False;
      end;
    finally
      DownloadPage.Hide;
    end;
  end else
    Result := True;
end;

function PrepareToInstall(var NeedsRestart: Boolean): String;
begin
  IsDotNet := IsDotNetInstalled(net48, 0);
end;

During the setup, it says that .NET 4.8 is missing and offers to
download it. But if I try to reinstall .NET 4.8 it throws:

Details
.NET Framework 4.8 or a later update is already installed on this computer.

What am I doing wrong?


Eivind Bakkestuen

unread,
Apr 9, 2024, 9:09:57 PMApr 9
to inno...@googlegroups.com
Check if the IsDotNetInstalled function is working correctly?

--
You received this message because you are subscribed to the Google Groups "innosetup" group.
To unsubscribe from this group and stop receiving emails from it, send an email to innosetup+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/innosetup/24e93071-b979-b7fb-3972-9fb8036c018f%40dressmaker.ca.

Info

unread,
Apr 10, 2024, 3:47:59 PMApr 10
to inno...@googlegroups.com
Eivind,

Was that an answer or a follow-up question?


Eivind Bakkestuen's profile photo

Eivind Bakkestuen

to inno...@googlegroups.com
Check if the IsDotNetInstalled function is working correctly?


Eivind Bakkestuen

unread,
Apr 10, 2024, 6:15:07 PMApr 10
to inno...@googlegroups.com
Both.

--
You received this message because you are subscribed to the Google Groups "innosetup" group.
To unsubscribe from this group and stop receiving emails from it, send an email to innosetup+...@googlegroups.com.

Info

unread,
Apr 11, 2024, 7:23:38 AMApr 11
to inno...@googlegroups.com
Isn't that function built-in and beyond my control, as per this?
https://jrsoftware.org/ishelp/topic_isxfunc_isdotnetinstalled.htm
Could you attempt to communicate more clearly than in single words or one-liners and explain what you mean? You are difficult to understand.


Eivind Bakkestuen

Both.

On 24/04/10 15:47, Info wrote:

Martijn Laan

unread,
Apr 11, 2024, 7:58:46 AMApr 11
to innosetup
For IsDotNetInstalled(net48, 0) to return True the following must be found in the registry:

Key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full
Values: Install must be 1, Servicing must be 0 or higher, Release must be 528040 or higher

You could also try using https://github.com/DomGries/InnoDependencyInstaller

Also, what is your ArchitecturesInstallIn64BitMode setting?

You should really post a complete example .iss always please instead of a snippet.

Greetings,
Martijn Laan

Op dinsdag 9 april 2024 om 20:16:29 UTC+2 schreef Info:

Info

unread,
Apr 11, 2024, 2:24:06 PMApr 11
to inno...@googlegroups.com
They are as you indicated. Release is 528049.
ArchitecturesInstallIn64BitMode is not used in the setup.
The code above is not a snippet: it is the complete code, and there is no more code in the setup.

I tried to assign true to IsDotNet in PrepareToInstall() instead of checking, but it still tried to d/l. Is it possible that PrepareToInstall() is not called prior to NextButtonClick() for wpReady?



On 24/04/11 07:23, Info wrote:

Martijn Laan

to innosetup

Martijn Laan

unread,
Apr 11, 2024, 2:49:16 PMApr 11
to innosetup
Op donderdag 11 april 2024 om 20:24:06 UTC+2 schreef Info:
They are as you indicated. Release is 528049.
ArchitecturesInstallIn64BitMode is not used in the setup.
The code above is not a snippet: it is the complete code, and there is no more code in the setup.

"Complete code" and " complete example .iss" is not the same thing: I meant something you can compile and run without having to make changes, and it as small as possible at the same time.
 
I tried to assign true to IsDotNet in PrepareToInstall() instead of checking, but it still tried to d/l. Is it possible that PrepareToInstall() is not called prior to NextButtonClick() for wpReady?

PrepareToInstall is never called prior to NextButtonClick for wpReady. After all the installation starts after the Ready Page.

You can check this by setting breakpoints.

Greetings,
Martijn

Info

unread,
Apr 11, 2024, 5:02:16 PMApr 11
to inno...@googlegroups.com
I could be wrong, but you seem to contradict documentation at
https://jrsoftware.org/ishelp/topic_scriptevents.htm
It says that PrepareToInstall() can be used to check for missing
prerequisites. If it is not called then the documentation is not
accurate or is confusing.

After I moved the detection up to NextButtonClick() as follows:

function NextButtonClick(CurPageID: Integer): Boolean;
begin
  IsDotNet := IsDotNetInstalled(net48, 0);

  if ((IsDotNet = false) and (CurPageID = wpReady)) then
  begin

a new problem appeared: although .NET 4.8 is correctly detected as
installed or missing, in the latter case the download commences and
instead of the downloaded installer being executed the setup completes
immediately, after which .NET 4.8 is still not installed.

Eivind Bakkestuen

unread,
Apr 11, 2024, 5:43:41 PMApr 11
to inno...@googlegroups.com
So how exactly are you executing the installer that was downloaded?

--
You received this message because you are subscribed to the Google Groups "innosetup" group.
To unsubscribe from this group and stop receiving emails from it, send an email to innosetup+...@googlegroups.com.

Gavin Lambert

unread,
Apr 11, 2024, 8:07:32 PMApr 11
to innosetup
On Friday, April 12, 2024 at 9:02:16 AM UTC+12 Info wrote:
I could be wrong, but you seem to contradict documentation at
https://jrsoftware.org/ishelp/topic_scriptevents.htm
It says that PrepareToInstall() can be used to check for missing
prerequisites. If it is not called then the documentation is not
accurate or is confusing.

The documentation is accurate; you misunderstood the response.

NextButtonClick(wpReady) happens first, and while you can perform some additional validation there, you must not actually try to install anything yet.  PrepareToInstall is called just after that, and this is the point at which you're allowed to start installing things.

Info

unread,
Apr 12, 2024, 5:28:33 PMApr 12
to inno...@googlegroups.com
LOL. I naively assumed that the code above that I inherited from my
predecessor should work. I did not know that in InnoSetup everything on
top of the actual install requires programming. Grabbed a sample from
github and all is good now: .NET installs. Chalk this off as closed.
Thanks for holding my hand!
Reply all
Reply to author
Forward
0 new messages