Can anyone shed light on this Inno Setup error that one of my users is getting?
He can install the same software on another computer with no issues. I asked him to supply me with his log file (the installer copies the log to a specific folder with a timestamp in the CurStepChange
procedure (when the CurStep = ssDone
).
But he could not find any log. I have now asked him to run the installer from a Command Prompt with the /log="..."
switch to see if we can get at the log that way.
His computer is running Windows 11 (this is also my development PC operating system).
Any ideas?
Note that the installer does check for the existing of the Framework in the InitializeWizard
procedure:
dotNetNeeded := not IsDotNetInstalled(net462, 0);
if (dotNetNeeded) then begin
if (MsgBox(ExpandConstant('{cm:DotNet_NeedToDownload}'), \
mbConfirmation, MB_OKCANCEL) = IDCANCEL) then begin
Abort();
end;
end;
Update
I am no Delphi developer, but I thought I would check the public source code for Inno Setup and I found two places where this error is displayed:
function GetDotNetInstallRoot(const RegView: TRegView): String;
var
K: HKEY;
begin
if DotNetRoot[RegView] = '' then begin
if RegOpenKeyExView(RegView, HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\.NETFramework', 0, KEY_QUERY_VALUE, K) = ERROR_SUCCESS then begin
RegQueryStringValue(K, 'InstallRoot', DotNetRoot[RegView]);
RegCloseKey(K);
end;
if DotNetRoot[RegView] = '' then
InternalError('.NET Framework not found');
end;
Result := DotNetRoot[RegView];
end;
function GetDotNetVersionInstallRoot(const RegView: TRegView; const Version: TDotNetBaseVersion): String;
const
VersionStrings: array [TDotNetBaseVersion] of String = ('1.1', '2.0', '4.0', '');
var
K: HKEY;
begin
if DotNetVersionRoot[RegView, Version] = '' then begin
GetDotNetInstallRoot(RegView);
if (Version in [netbase40, netbaseHighestKnown]) and (RegOpenKeyExView(RegView, HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\.NETFramework\Policy\v4.0', 0, KEY_QUERY_VALUE, K) = ERROR_SUCCESS) then begin
DotNetVersionRoot[RegView, Version] := AddBackslash(DotNetRoot[RegView]) + 'v4.0.30319';
RegCloseKey(K);
end else if (Version in [netbase20, netbaseHighestKnown]) and (RegOpenKeyExView(RegView, HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\.NETFramework\Policy\v2.0', 0, KEY_QUERY_VALUE, K) = ERROR_SUCCESS) then begin
DotNetVersionRoot[RegView, Version] := AddBackslash(DotNetRoot[RegView]) + 'v2.0.50727';
RegCloseKey(K);
end else if (Version in [netbase11, netbaseHighestKnown]) and (RegOpenKeyExView(RegView, HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\.NETFramework\Policy\v1.1', 0, KEY_QUERY_VALUE, K) = ERROR_SUCCESS) then begin
DotNetVersionRoot[RegView, Version] := AddBackslash(DotNetRoot[RegView]) + 'v1.1.4322';
RegCloseKey(K);
end;
if DotNetVersionRoot[RegView, Version] = '' then begin
if Version <> netbaseHighestKnown then
InternalError(Format('.NET Framework version %s not found', [VersionStrings[Version]]))
else
InternalError('.NET Framework not found');
end;
end;
Result := DotNetVersionRoot[RegView, Version];
end;
That code is in the DotNet.pas
file.
As a resut of the above location in Inno Setup raising the error, I have asked him to use regedit and verify the existing off:
\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319
Update
So he did try the install using the /log
switch and as expected, it says:
2022-05-13 14:15:46.196 Fatal exception during installation process (Exception):
Internal error: .NET Framework not found.
2022-05-13 14:15:46.196 Exception message:
2022-05-13 14:15:46.196 Message box (OK):
Internal error: .NET Framework not found.
2022-05-13 14:15:53.456 User chose OK.
2022-05-13 14:15:53.456 Message box (OK):
Setup was not completed.
Please correct the problem and run Setup again.
2022-05-13 14:15:59.450 User chose OK.
2022-05-13 14:15:59.450 Rolling back changes.
2022
I now await his response about the registry key.
I can confirm that in his case, whilst all the framework files etc are installed, that the cause of the internal failure is this function:
function GetDotNetInstallRoot(const RegView: TRegView): String;
var
K: HKEY;
begin
if DotNetRoot[RegView] = '' then begin
if RegOpenKeyExView(RegView, HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\.NETFramework', 0, KEY_QUERY_VALUE, K) = ERROR_SUCCESS then begin
RegQueryStringValue(K, 'InstallRoot', DotNetRoot[RegView]);
RegCloseKey(K);
end;
if DotNetRoot[RegView] = '' then
InternalError('.NET Framework not found');
end;
Result := DotNetRoot[RegView];
end;
Here does not have the InstallRoot
registry value.