论坛风格切换切换到宽版
  • 3719阅读
  • 4回复

inno做的安装包出现这样的错误? [复制链接]

上一主题 下一主题
离线syl1130
 

发帖
81
金钱
510
威望
71
只看楼主 倒序阅读 0 发表于: 2016-10-23
版主你好,
为何做好编译的安装包,很多人安装是正常的,但是有小部分人安装的时候出现一个错误提示,一直没有搞懂是什么问题?

本帖提到的人: @gnatix @restools @wanfu
离线lovelost

发帖
140
金钱
1060
威望
106
只看该作者 1 发表于: 2016-10-24
应该是你的安装脚本有问题,猜测你的目标路径通过读注册表或ini等方式获取,在部分机器上获取出错了。
脚本贴出来看看。
离线syl1130

发帖
81
金钱
510
威望
71
只看该作者 2 发表于: 2016-10-24
回 1楼(lovelost) 的帖子
@lovelost
代码如下:
----------------------------------------------------------
[Setup]
; 注意: AppId 的值是唯一识别这个程序的标志。
; 不要在其他程序中使用相同的 AppId 值。
; (在编译器中点击菜单“工具 -> 产生 GUID”可以产生一个新的 GUID)
UserInfoPage=true
DisableStartupPrompt=yes
DirExistsWarning=no
AppId={{0E8C5C12-111D-49DD-991E-3D268B0B7F3C}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
DefaultDirName={reg:HKLM\SOFTWARE\Autodesk\3dsMax\18.0,Installdir|{pf}}
DisableDirPage=yes
DisableProgramGroupPage=yes
DisableReadyPage=yes
OutputDir=C:\Users\Alxen\Desktop\test
OutputBaseFilename=setup
UsePreviousTasks=yes
Encryption=no
Compression=lzma/ultra64
SolidCompression=yes
Uninstallable=no
AppendDefaultDirName=no

ArchitecturesInstallIn64BitMode=x64
ArchitecturesAllowed=x64


[Files]
; 安装需要文件
Source: "C:\Users\Alxen\Desktop\setup.bat"; DestDir: "{tmp}"; Flags: ignoreversion deleteafterinstall


[Run]
Filename: "{tmp}\setup.bat"; Parameters: /s; StatusMsg: "正在安装文件...."; Flags: nowait runhidden;



本帖提到的人: @restools @wanfu @lovelost
离线lovelost

发帖
140
金钱
1060
威望
106
只看该作者 3 发表于: 2016-10-25
应该是在出错的那些机器的注册表中HKLM\SOFTWARE\Autodesk\3dsMax\18.0,Installdir的键是存在的,但是Installdir的值是空的引起的。可自己写一段代码来检测Installdir的值是否为空。
[Setup]
UserInfoPage=true
DisableStartupPrompt=yes
DirExistsWarning=no
AppId={{0E8C5C12-111D-49DD-991E-3D268B0B7F3C}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppPublisher={#MyAppPublisher}
DefaultDirName={code:GetPreviousPath}
DisableDirPage=yes
DisableProgramGroupPage=yes
DisableReadyPage=yes
OutputDir=C:\Users\Alxen\Desktop\test
OutputBaseFilename=setup
UsePreviousTasks=yes
Encryption=no
Compression=lzma/ultra64
SolidCompression=yes
Uninstallable=no
AppendDefaultDirName=no

ArchitecturesInstallIn64BitMode=x64
ArchitecturesAllowed=x64


[Files]
; 安装需要文件
Source: "C:\Users\Alxen\Desktop\setup.bat"; DestDir: "{tmp}"; Flags: ignoreversion deleteafterinstall


[Run]
Filename: "{tmp}\setup.bat"; Parameters: /s; StatusMsg: "正在安装文件...."; Flags: nowait runhidden;

[CODE]
function GetPreviousPath(Default: String): String;
var
sPath: String;
begin
  RegQueryStringValue( HKLM, 'SOFTWARE\Autodesk\3dsMax\18.0', 'Installdir', sPath );
  if sPath = '' then
     begin
       sPath := ExpandConstant('{pf}');
     end;
  Result := sPath;
end;

离线syl1130

发帖
81
金钱
510
威望
71
只看该作者 4 发表于: 2016-10-25
回 3楼(lovelost) 的帖子
lovelost:应该是在出错的那些机器的注册表中HKLM\SOFTWARE\Autodesk\3dsMax\18.0,Installdir的键是存在的,但是Installdir的值是空的引起的。可自己写一段代码来检测Installdir的值是否为空。[Setup]UserInfoPage=trueDisableStar .. (2016-10-25 12:22) 

谢谢lovelost , 已经成功解决  多谢