0

This started life as a discussion here and it boils down to the following [Run] entries:

Filename: "{dotnet40}\regasm.exe"; \
    Parameters: "PTSTools_x86.dll /codebase"; \
    WorkingDir: "{app}"; \
    Flags: runhidden

Filename: "{dotnet4064}\regasm.exe"; \
    Parameters: "PTSTools_x64.dll /codebase"; \
    WorkingDir: "{app}"; \
    Flags: runhidden; \
    Check: IsWin64

As documented here about Constants it states:

{dotnet40}

...

An exception will be raised if an attempt is made to expand this constant on a system with no .NET Framework version 4.0 or later present.

And it says similar for {dotnet4064}:

An exception will be raised if an attempt is made to expand this constant on a system with no .NET Framework version 4.0 or later present.

Now, the statement is a little misleading because I looked under the hood at the Inno Setup code, and if the InstallRoot registry key is missing it will raise an exception (Internal Error). This itself does not mean the Framework is not installed. But this is a side issue.

What is the most elegant way for us to cater for this requirement to use try/catch so that we don't get this cryptic popup? I actually had a user who had this happen and it was because he did not have the InstallRoot key.

Andrew Truckle
  • 17,769
  • 16
  • 66
  • 164
  • @MartinPrikryl I am not sure really. But, if the reason the constant did not expand was because that `InstallRoot` was missing it should state that. Apparently, some installers tell the user to create the key. Particular if the other keys are present. Maybe it is not worth the hastle. – Andrew Truckle Jun 08 '22 at 08:03
  • 1
    Then you should check before installation if the `InstallRoot` registry value exists, and if not display an error and prevent the installation. Instead of checking it too late, when expanding the constant. Or in addition to checking `InstallRoot`, you can also try to expand the constant, displaying some fallback error (*"something wrong with .NET installation"*). – Martin Prikryl Jun 08 '22 at 08:24

0 Answers0