0

我正在尝试使用 Microsoft 的 Desktop App Converter 将我使用 inno-setup 制作的 Install .exe 文件转换为 appx 文件。它每次都挂在“等待安装程序处理以在隔离环境中完成”。

我在 Desktop App Converter 中使用的命令是:

DesktopAppConverter.exe -Installer "C:\Users\Desktop\Output\setup.exe"              -Destination "C:\Users\Desktop\MyProgram\" -PackageName    "MyProgramApps"  -Publisher "Me"
-Version 0.1.4.0 -MakeAppx -Verbose -InstallerArguments  "/VERYSILENT"  -PackagePublisherDisplayName "MyApps" -PackageDisplayName "MyProgram"   -AppDisplayName "MyProgram" -AppId "MyProgram"

当我使用“/VERYSILENT”从命令行运行“MyProgram.exe”时,它会完全静默安装。

Inno-Setup 的脚本是:

#define MyAppName "MyProgram"
#define MyAppVersion "0.1.7"
#define MyAppPublisher "MyApps"
#define MyAppExeName "MyProgram.exe"


[Setup]
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppPublisher={#MyAppPublisher}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
OutputDir=C:\Users\Desktop\Output
OutputBaseFilename=thirteenth_setup
Compression=lzma
SolidCompression=yes


[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}";        GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked


[Files]

Source: "C:\Users\Desktop\resources\MyProgram.exe"; DestDir: "{app}";  Flags: ignoreversion
#define JavaInstaller "jre-8u151-windows-x64.exe"
Source: "{#JavaInstaller}";  DestDir: "{tmp}"; Flags: dontcopy

[Icons]
Name: "{commonprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}";  Tasks: desktopicon

[Run]
Filename: "{app}\{#MyAppExeName}"; \
Description: "{cm:LaunchProgram,{#StringChange(MyAppName,'&', '&&' )}}"; \
Flags: nowait postinstall skipifsilent



[Code]
const
  REQUIRED_JAVA_VERSION = '1.7';

function isJavaInstalled(): Boolean;
var
  JavaVer : String;
  tmpFileName,
  pathJavaExe: String;
  isGoodJavaVersion,
  isFoundJavaPath: Boolean;
  ResultCode: Integer;
  ExecStdout: AnsiString;
begin

  { *** check in registry }
  { sets variables: }
  {   JavaVer }
  {   isGoodJavaVersion }
  if RegQueryStringValue(HKLM, 'SOFTWARE\JavaSoft\Java Runtime   Environment',
           'CurrentVersion', JavaVer) AND (JavaVer <> '') OR
     RegQueryStringValue(HKLM64, 'SOFTWARE\JavaSoft\Java Runtime Environment',
           'CurrentVersion', JavaVer) AND (JavaVer <> '') then begin
    Log('* Java Entry in Registry present. Version: ' + JavaVer);
    isGoodJavaVersion := CompareStr(JavaVer, REQUIRED_JAVA_VERSION) >= 0;
  end;

  { add additional checks, for example by searching the PATH, }
  { or by running `java -version` }

  Result := isGoodJavaVersion;
end;
procedure ExtractInstaller;
begin
   ExtractTemporaryFile('{#JavaInstaller}');
end;


[Run]
Filename: "{tmp}\{#JavaInstaller}";  Parameters: "SPONSORS=0"; \
   StatusMsg: "Java Runtime Enviroment not installed on your system.  Installing..."; \
   Check: not isJavaInstalled;  BeforeInstall: ExtractInstaller;

我认为这与以下方面有关:

[Run]
Filename: "{tmp}\{#JavaInstaller}";  Parameters: "SPONSORS=0"; \
   StatusMsg: "Java Runtime Enviroment not installed on your system.  Installing..."; \
   Check: not isJavaInstalled;  BeforeInstall: ExtractInstaller;

因为当我在没有那个“运行”语句的情况下运行它时,DAC 就会运行到完成。但是当然 Java 安装程序不会运行。

4

1 回答 1

0

您还可以使用与 Microsoft 合作开发的Advanced Installer 的新免费 Express 版本转换软件包,其目的是补充 Desktop App Converter。

比如你的INNO包的安装可以是交互式的,有UI的,所以你可以手动运行安装程序完成安装,这样应该可以避免上面的问题。

它有一个允许高级定制 APPX 包的 GUI,而无需您了解内部包模式。

如果您对此有任何疑问,请告诉我,很乐意提供帮助。

免责声明:我在构建 Advanced Installer 的团队中工作。

于 2018-03-29T08:50:01.583 回答