INNO设置编译器6.4.1-安装.NET 9 FAILSINES设置

问题描述 投票:0回答:1
ok更新: 我对此进行了更多的工作,现在它进行了编译,几乎可以做到它应该做的事情,但是安装似乎总是会因错误2而失败,我相信这来自.net9安装。

Path似乎很好(它在技术上都与.iss相同)。 我不确定为什么它会出现错误2,因为该路径在CMD中似乎有效。

我知道我还适当地错过了需要调整或修复的更多内容,但这就是我现在被困的地方...

等于.NET 9.0.2或更高的已安装,并且.NET安装被跳过安装效果很好。

[Setup] AppName=OffinoViewer AppVersion=1.0 DefaultDirName={autopf}\OffinoViewer DefaultGroupName=OffinoViewer OutputDir=Output OutputBaseFilename=OffinoViewerSetup SetupIconFile=favicon.ico PrivilegesRequired=admin ; Require administrator privileges ArchitecturesAllowed=x64os ;for 64-bit systems only ; Add a custom wizard page WizardStyle=modern DisableWelcomePage=no ; Make Start Menu folder optional AllowNoIcons=yes DisableProgramGroupPage=no AlwaysShowGroupOnReadyPage=yes [Tasks] Name: "desktopicon"; Description: "Create a &desktop shortcut"; GroupDescription: "Additional icons:" Name: "startmenuicon"; Description: "Create a &Start Menu folder"; GroupDescription: "Additional icons:"; Flags: unchecked [Files] Source: "C:\Users\[myusernameIdontwantdispalyed]\Documents\Release Public\dotnet-runtime-9.0.2-win-x64.exe"; DestDir: "{tmp}"; Flags: ignoreversion ; Your application files Source: "OffinoViewer.exe"; DestDir: "{app}"; Flags: ignoreversion ; Add other files your application needs ; Include the .NET 9.0.2 offline installer [Code] var DotNetCheckPage: TOutputMsgWizardPage; RequiresNetInstall: Boolean; function GetDotNetVersion(): String; var regKey: String; versionString: String; success: Boolean; begin regKey := 'SOFTWARE\Microsoft\NET Core\Setup\InstalledVersions\x64\sharedhost'; success := RegQueryStringValue(HKLM64, regKey, 'Version', versionString); if success then Result := versionString else Result := ''; end; function IsDotNet902Installed(): Boolean; var installedVersion: String; targetVersion: String; begin targetVersion := '9.0.2'; installedVersion := GetDotNetVersion(); // Check if installed version is greater than or equal to 9.0.2 Result := (installedVersion <> '') and (CompareStr(installedVersion, targetVersion) >= 0); end; procedure InitializeWizard; begin // Create the .NET check page DotNetCheckPage := CreateOutputMsgPage(wpWelcome, 'System Requirements Check', 'Checking .NET Runtime requirements...',''); // Check if .NET is installed and update the page if IsDotNet902Installed() then begin DotNetCheckPage.Description := '.NET Runtime 9.0.2 is already installed on your system.' + #13#10 + 'Click Next to continue with the installation.'; RequiresNetInstall := False; end else begin DotNetCheckPage.Description := '.NET Runtime 9.0.2 was not found.' + #13#10 + 'The installer will download and install it automatically.' + #13#10 + 'Click Next to continue.'; RequiresNetInstall := True; end; end; function PrepareToInstall(var NeedsRestart: Boolean): String; var ResultCode: Integer; begin Result := ''; // Only install .NET if it's required if RequiresNetInstall then begin // Update status message WizardForm.StatusLabel.Caption := 'Installing .NET Runtime 9.0.2...'; WizardForm.ProgressGauge.Style := npbstMarquee; // Install .NET 9.0.2 Runtime if not Exec(ExpandConstant('{tmp}\dotnet-runtime-9.0.2-win-x64.exe'), '/install /quiet /norestart', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then begin Result := 'Failed to install .NET 9.0.2 Runtime. Error code: ' + IntToStr(ResultCode); Exit; end; // Check if installation requires restart if ResultCode = 3010 then NeedsRestart := True; end; end; [Icons] Name: "{group}\OffinoViewer"; Filename: "{app}\OffinoViewer.exe"; Tasks: startmenuicon Name: "{group}\Uninstall OffinoViewer"; Filename: "{uninstallexe}"; Tasks: startmenuicon Name: "{autodesktop}\OffinoViewer"; Filename: "{app}\OffinoViewer.exe"; Tasks: desktopicon

提前感谢!

在Pascal(脚本)中,您必须定义一个函数,然后才能调用它。在定义它之前,您正在调用
IsDotNetInstalled

。通常,您会得到

“未知标识符” isDotnetInstalled'
inno-setup pascalscript
1个回答
0
投票
构建功能

IsDotNetInstalled

,它需要两个参数。这就是为什么您要获得“参数数量无效”的原因。
InitializeSetup之前将功能定义移动。最好以不同的方式命名它,不要引起内置功能的混乱。
(您会发现您的代码中还有其他问题)

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.