我正在尝试构建一个以 postgresql 作为先决条件的包。我正在尝试通过搜索注册表来检测 postgresql,如下所示:
<Fragment>
<util:RegistrySearch Id ="PostgresqlPath_x64"
Root="HKLM"
Key="SOFTWARE\PostgreSQL\Installations\postgresql-x64-9.1"
Result="exists"
Variable="PostgresqlInstalled_x64"
Win64="yes" />
<util:RegistrySearch Id="Postgresql_x86"
Root="HKLM"
Key="SOFTWARE\PostgreSQL\Installations\postgresql-9.1"
Result="exists"
Variable="PostgresqlInstalled_x86"
Win64="no"/>
然后在 ExePackage 中使用它:
<ExePackage SourceFile="..\..\bin\external_software\postgreSQL\postgresql-9.1.6-1-windows-x64.exe"
InstallCommand="$(var.PostgresqlInstallCommand)"
InstallCondition="VersionNT64"
DetectCondition="PostgresqlInstalled_x64"
PerMachine="yes"
Compressed="yes"/>
<ExePackage SourceFile="..\..\bin\external_software\postgreSQL\postgresql-9.1.6-1-windows.exe"
InstallCommand="$(var.PostgresqlInstallCommand)"
InstallCondition="(NOT VersionNT64)"
DetectCondition="PostgresqlInstalled_x86"
PerMachine="yes" Compressed="yes" />
即使安装了 Postgresql,它也会评估为 false,无论我正在测试什么 Win 版本(x86 或 x64)。
我在这里做错了什么吗?:/
这里是安装的完整日志文件:
[072C:0664][2013-10-08T15:32:15]i001: Burn v3.7.1224.0, Windows v6.1 (Build 7601: Service Pack 1), path: C:\Users\A521064\Desktop\sLIM_Bootstrapper.exe, cmdline: ''
[072C:0664][2013-10-08T15:32:15]i000: Initializing string variable 'PostgresqlUninstall' to value 'PostgreSQL\9.1\uninstall-postgresql.exe'
[072C:0664][2013-10-08T15:32:15]i000: Setting string variable 'WixBundleLog' to value 'C:\Users\A521064\AppData\Local\Temp\sLIM_Controller_(Bundle)_20131008153215.log'
[072C:0664][2013-10-08T15:32:15]i000: Setting string variable 'WixBundleOriginalSource' to value 'C:\Users\A521064\Desktop\sLIM_Bootstrapper.exe'
[072C:0664][2013-10-08T15:32:15]i052: Condition 'VersionNT >= v5.1' evaluates to true.
[072C:0664][2013-10-08T15:32:15]i000: Setting string variable 'WixBundleName' to value 'sLIM Controller (Bundle)'
[072C:0664][2013-10-08T15:32:16]i100: Detect begin, 3 packages
[072C:0664][2013-10-08T15:32:16]i052: Condition 'PostgresqlInstalled_x64' evaluates to false.
[072C:0664][2013-10-08T15:32:16]i052: Condition 'PostgresqlInstalled_x86 OR PostgresqlInstalled_x86_2' evaluates to false.
[072C:0664][2013-10-08T15:32:16]i101: Detected package: postgresql_9.1.6_1_windows_x64.exe, state: Absent, cached: None
[072C:0664][2013-10-08T15:32:16]i101: Detected package: postgresql_9.1.6_1_windows.exe, state: Absent, cached: None
[072C:0664][2013-10-08T15:32:16]i101: Detected package: sLIMInstall.msi, state: Absent, cached: None
[072C:0664][2013-10-08T15:32:16]i199: Detect complete, result: 0x0
[072C:0664][2013-10-08T15:32:17]i200: Plan begin, 3 packages, action: Install
[072C:0664][2013-10-08T15:32:17]i052: Condition 'VersionNT64' evaluates to true.
[072C:0664][2013-10-08T15:32:17]w321: Skipping dependency registration on package with no dependency providers: postgresql_9.1.6_1_windows_x64.exe
[072C:0664][2013-10-08T15:32:17]i000: Setting string variable 'WixBundleLog_postgresql_9.1.6_1_windows_x64.exe' to value 'C:\Users\A521064\AppData\Local\Temp\sLIM_Controller_(Bundle)_20131008153215_0_postgresql_9.1.6_1_windows_x64.exe.log'
[072C:0664][2013-10-08T15:32:17]i000: Setting string variable 'WixBundleRollbackLog_postgresql_9.1.6_1_windows_x64.exe' to value 'C:\Users\A521064\AppData\Local\Temp\sLIM_Controller_(Bundle)_20131008153215_0_postgresql_9.1.6_1_windows_x64.exe_rollback.log'
[072C:0664][2013-10-08T15:32:17]i052: Condition '(NOT VersionNT64)' evaluates to false.
[072C:0664][2013-10-08T15:32:17]w321: Skipping dependency registration on package with no dependency providers: postgresql_9.1.6_1_windows.exe
[072C:0664][2013-10-08T15:32:17]i052: Condition 'VersionNT64 >= v5.1' evaluates to true.
[072C:0664][2013-10-08T15:32:17]i000: Setting string variable 'WixBundleRollbackLog_sLIMInstall.msi' to value 'C:\Users\A521064\AppData\Local\Temp\sLIM_Controller_(Bundle)_20131008153215_1_sLIMInstall.msi_rollback.log'
[072C:0664][2013-10-08T15:32:17]i000: Setting string variable 'WixBundleLog_sLIMInstall.msi' to value 'C:\Users\A521064\AppData\Local\Temp\sLIM_Controller_(Bundle)_20131008153215_1_sLIMInstall.msi.log'
[072C:0664][2013-10-08T15:32:17]i201: Planned package: postgresql_9.1.6_1_windows_x64.exe, state: Absent, default requested: Present, ba requested: Present, execute: Install, rollback: Uninstall, cache: Yes, uncache: No, dependency: None
[072C:0664][2013-10-08T15:32:17]i201: Planned package: postgresql_9.1.6_1_windows.exe, state: Absent, default requested: Absent, ba requested: Absent, execute: None, rollback: None, cache: No, uncache: No, dependency: None
[072C:0664][2013-10-08T15:32:17]i201: Planned package: sLIMInstall.msi, state: Absent, default requested: Present, ba requested: Present, execute: Install, rollback: Uninstall, cache: Yes, uncache: No, dependency: Register
[072C:0664][2013-10-08T15:32:17]i299: Plan complete, result: 0x0
[072C:0664][2013-10-08T15:32:17]i300: Apply begin
[0B08:0AB8][2013-10-08T15:32:20]i360: Creating a system restore point.
[0B08:0AB8][2013-10-08T15:32:33]i361: Created a system restore point.
[0B08:0AB8][2013-10-08T15:32:33]i000: Caching bundle from: 'C:\Users\A521064\AppData\Local\Temp\{cef60084-9565-4990-b3d6-2704a4475eab}\.be\sLIM_Bootstrapper.exe' to: 'C:\ProgramData\Package Cache\{cef60084-9565-4990-b3d6-2704a4475eab}\sLIM_Bootstrapper.exe'
[0B08:0AB8][2013-10-08T15:32:33]i320: Registering bundle dependency provider: {cef60084-9565-4990-b3d6-2704a4475eab}, version: 0.9.18.0
[0B08:0960][2013-10-08T15:32:39]i305: Verified acquired payload: postgresql_9.1.6_1_windows_x64.exe at path: C:\ProgramData\Package Cache\.unverified\postgresql_9.1.6_1_windows_x64.exe, moving to: C:\ProgramData\Package Cache\E8DC6F6A96D4A4821F149FA9CA67B35C506645C1\postgresql-9.1.6-1-windows-x64.exe.
[0B08:0960][2013-10-08T15:32:39]i305: Verified acquired payload: sLIMInstall.msi at path: C:\ProgramData\Package Cache\.unverified\sLIMInstall.msi, moving to: C:\ProgramData\Package Cache\{4E9DAE71-AC58-4A0C-A63F-2AC752C983EF}v0.9.19\sLIMInstall.msi.
[0B08:0AB8][2013-10-08T15:32:40]i301: Applying execute package: postgresql_9.1.6_1_windows_x64.exe, action: Install, path: C:\ProgramData\Package Cache\E8DC6F6A96D4A4821F149FA9CA67B35C506645C1\postgresql-9.1.6-1-windows-x64.exe, arguments: '"C:\ProgramData\Package Cache\E8DC6F6A96D4A4821F149FA9CA67B35C506645C1\postgresql-9.1.6-1-windows-x64.exe" --mode unattended --superpassword postgres --servicepassword postgres --debuglevel 4 --unattendedmodeui none --install_runtimes 0'
[072C:0664][2013-10-08T15:34:01]i319: Applied execute package: postgresql_9.1.6_1_windows_x64.exe, result: 0x0, restart: None
[0B08:0AB8][2013-10-08T15:34:01]i323: Registering package dependency provider: {4E9DAE71-AC58-4A0C-A63F-2AC752C983EF}, version: 0.9.19, package: sLIMInstall.msi
[0B08:0AB8][2013-10-08T15:34:01]i301: Applying execute package: sLIMInstall.msi, action: Install, path: C:\ProgramData\Package Cache\{4E9DAE71-AC58-4A0C-A63F-2AC752C983EF}v0.9.19\sLIMInstall.msi, arguments: ' ARPSYSTEMCOMPONENT="1" MSIFASTINSTALL="7"'
[072C:0664][2013-10-08T15:34:42]i319: Applied execute package: sLIMInstall.msi, result: 0x0, restart: None
[0B08:0AB8][2013-10-08T15:34:42]i325: Registering dependency: {cef60084-9565-4990-b3d6-2704a4475eab} on package provider: {4E9DAE71-AC58-4A0C-A63F-2AC752C983EF}, package: sLIMInstall.msi
[072C:0664][2013-10-08T15:34:42]i399: Apply complete, result: 0x0, restart: None, ba requested restart: No
[072C:0664][2013-10-08T15:34:45]i500: Shutting down, exit code: 0x0
[072C:0664][2013-10-08T15:34:45]i410: Variable: PostgresqlUninstall = PostgreSQL\9.1\uninstall-postgresql.exe
[072C:0664][2013-10-08T15:34:45]i410: Variable: VersionNT = 6.1.0.0
[072C:0664][2013-10-08T15:34:45]i410: Variable: VersionNT64 = 6.1.0.0
[072C:0664][2013-10-08T15:34:45]i410: Variable: WixBundleAction = 4
[072C:0664][2013-10-08T15:34:45]i410: Variable: WixBundleElevated = 1
[072C:0664][2013-10-08T15:34:45]i410: Variable: WixBundleInstalled = 0
[072C:0664][2013-10-08T15:34:45]i410: Variable: WixBundleLog = C:\Users\A521064\AppData\Local\Temp\sLIM_Controller_(Bundle)_20131008153215.log
[072C:0664][2013-10-08T15:34:45]i410: Variable: WixBundleLog_postgresql_9.1.6_1_windows_x64.exe = C:\Users\A521064\AppData\Local\Temp\sLIM_Controller_(Bundle)_20131008153215_0_postgresql_9.1.6_1_windows_x64.exe.log
[072C:0664][2013-10-08T15:34:45]i410: Variable: WixBundleLog_sLIMInstall.msi = C:\Users\A521064\AppData\Local\Temp\sLIM_Controller_(Bundle)_20131008153215_1_sLIMInstall.msi.log
[072C:0664][2013-10-08T15:34:45]i410: Variable: WixBundleManufacturer = Atos IT Solutions and Services
[072C:0664][2013-10-08T15:34:45]i410: Variable: WixBundleName = sLIM Controller (Bundle)
[072C:0664][2013-10-08T15:34:45]i410: Variable: WixBundleOriginalSource = C:\Users\A521064\Desktop\sLIM_Bootstrapper.exe
[072C:0664][2013-10-08T15:34:45]i410: Variable: WixBundleProviderKey = {cef60084-9565-4990-b3d6-2704a4475eab}
[072C:0664][2013-10-08T15:34:45]i410: Variable: WixBundleRollbackLog_postgresql_9.1.6_1_windows_x64.exe = C:\Users\A521064\AppData\Local\Temp\sLIM_Controller_(Bundle)_20131008153215_0_postgresql_9.1.6_1_windows_x64.exe_rollback.log
[072C:0664][2013-10-08T15:34:45]i410: Variable: WixBundleRollbackLog_sLIMInstall.msi = C:\Users\A521064\AppData\Local\Temp\sLIM_Controller_(Bundle)_20131008153215_1_sLIMInstall.msi_rollback.log
[072C:0664][2013-10-08T15:34:45]i410: Variable: WixBundleTag =
[072C:0664][2013-10-08T15:34:45]i410: Variable: WixBundleVersion = 0.9.18.0
[072C:0664][2013-10-08T15:34:45]i007: Exit code: 0x0, restarting: No
再次卸载时找不到 reg 密钥:
[0AC0:05E0][2013-10-08T15:47:54]i001: Burn v3.7.1224.0, Windows v6.1 (Build 7601: Service Pack 1), path: C:\Users\A521064\Desktop\sLIM_Bootstrapper.exe, cmdline: ''
[0AC0:05E0][2013-10-08T15:47:54]i000: Initializing string variable 'PostgresqlUninstall' to value 'PostgreSQL\9.1\uninstall-postgresql.exe'
[0AC0:05E0][2013-10-08T15:47:54]i000: Setting string variable 'WixBundleLog' to value 'C:\Users\A521064\AppData\Local\Temp\sLIM_Controller_(Bundle)_20131008154754.log'
[0AC0:05E0][2013-10-08T15:47:54]i000: Setting string variable 'WixBundleOriginalSource' to value 'C:\Users\A521064\Desktop\sLIM_Bootstrapper.exe'
[0AC0:05E0][2013-10-08T15:47:54]i052: Condition 'VersionNT >= v5.1' evaluates to true.
[0AC0:05E0][2013-10-08T15:47:54]i100: Detect begin, 3 packages
[0AC0:05E0][2013-10-08T15:47:54]i052: Condition 'PostgresqlInstalled_x64' evaluates to false.
[0AC0:05E0][2013-10-08T15:47:54]i052: Condition 'PostgresqlInstalled_x86 OR PostgresqlInstalled_x86_2' evaluates to false.
[0AC0:05E0][2013-10-08T15:47:54]i101: Detected package: postgresql_9.1.6_1_windows_x64.exe, state: Absent, cached: Complete
[0AC0:05E0][2013-10-08T15:47:54]i101: Detected package: postgresql_9.1.6_1_windows.exe, state: Absent, cached: None
[0AC0:05E0][2013-10-08T15:47:54]i101: Detected package: sLIMInstall.msi, state: Present, cached: Complete
[0AC0:05E0][2013-10-08T15:47:54]i199: Detect complete, result: 0x0
[0AC0:05E0][2013-10-08T15:48:07]i200: Plan begin, 3 packages, action: Uninstall
[0AC0:05E0][2013-10-08T15:48:07]i000: Setting string variable 'WixBundleRollbackLog_sLIMInstall.msi' to value 'C:\Users\A521064\AppData\Local\Temp\sLIM_Controller_(Bundle)_20131008154754_0_sLIMInstall.msi_rollback.log'
[0AC0:05E0][2013-10-08T15:48:07]i000: Setting string variable 'WixBundleLog_sLIMInstall.msi' to value 'C:\Users\A521064\AppData\Local\Temp\sLIM_Controller_(Bundle)_20131008154754_0_sLIMInstall.msi.log'
[0AC0:05E0][2013-10-08T15:48:07]w321: Skipping dependency registration on package with no dependency providers: postgresql_9.1.6_1_windows.exe
[0AC0:05E0][2013-10-08T15:48:07]w321: Skipping dependency registration on package with no dependency providers: postgresql_9.1.6_1_windows_x64.exe
[0AC0:05E0][2013-10-08T15:48:07]i201: Planned package: sLIMInstall.msi, state: Present, default requested: Absent, ba requested: Absent, execute: Uninstall, rollback: Install, cache: No, uncache: Yes, dependency: Unregister
[0AC0:05E0][2013-10-08T15:48:07]i201: Planned package: postgresql_9.1.6_1_windows.exe, state: Absent, default requested: Absent, ba requested: Absent, execute: None, rollback: None, cache: No, uncache: No, dependency: None
[0AC0:05E0][2013-10-08T15:48:07]i201: Planned package: postgresql_9.1.6_1_windows_x64.exe, state: Absent, default requested: Absent, ba requested: Absent, execute: None, rollback: None, cache: No, uncache: Yes, dependency: None
[0AC0:05E0][2013-10-08T15:48:07]i299: Plan complete, result: 0x0
[0AC0:05E0][2013-10-08T15:48:07]i300: Apply begin
[0600:0B3C][2013-10-08T15:48:09]i360: Creating a system restore point.
[0600:0B3C][2013-10-08T15:48:19]i361: Created a system restore point.
[0600:0B3C][2013-10-08T15:48:19]i326: Removed dependency: {cef60084-9565-4990-b3d6-2704a4475eab} on package provider: {4E9DAE71-AC58-4A0C-A63F-2AC752C983EF}, package sLIMInstall.msi
[0600:0B3C][2013-10-08T15:48:19]i329: Removed package dependency provider: {4E9DAE71-AC58-4A0C-A63F-2AC752C983EF}, package: sLIMInstall.msi
[0600:0B3C][2013-10-08T15:48:19]i301: Applying execute package: sLIMInstall.msi, action: Uninstall, path: C:\ProgramData\Package Cache\{4E9DAE71-AC58-4A0C-A63F-2AC752C983EF}v0.9.19\sLIMInstall.msi, arguments: ' ARPSYSTEMCOMPONENT="1" MSIFASTINSTALL="7"'
[0AC0:05E0][2013-10-08T15:48:22]i319: Applied execute package: sLIMInstall.msi, result: 0x0, restart: None
[0600:0B3C][2013-10-08T15:48:22]i351: Removing cached package: sLIMInstall.msi, from path: C:\ProgramData\Package Cache\{4E9DAE71-AC58-4A0C-A63F-2AC752C983EF}v0.9.19\
[0600:0B3C][2013-10-08T15:48:22]i351: Removing cached package: postgresql_9.1.6_1_windows_x64.exe, from path: C:\ProgramData\Package Cache\E8DC6F6A96D4A4821F149FA9CA67B35C506645C1\
[0600:0B3C][2013-10-08T15:48:22]i330: Removed bundle dependency provider: {cef60084-9565-4990-b3d6-2704a4475eab}
[0600:0B3C][2013-10-08T15:48:22]i352: Removing cached bundle: {cef60084-9565-4990-b3d6-2704a4475eab}, from path: C:\ProgramData\Package Cache\{cef60084-9565-4990-b3d6-2704a4475eab}\
[0AC0:05E0][2013-10-08T15:48:23]i399: Apply complete, result: 0x0, restart: None, ba requested restart: No
[0AC0:05E0][2013-10-08T15:48:43]i500: Shutting down, exit code: 0x0
[0AC0:05E0][2013-10-08T15:48:43]i410: Variable: PostgresqlUninstall = PostgreSQL\9.1\uninstall-postgresql.exe
[0AC0:05E0][2013-10-08T15:48:43]i410: Variable: VersionNT = 6.1.0.0
[0AC0:05E0][2013-10-08T15:48:43]i410: Variable: WixBundleAction = 3
[0AC0:05E0][2013-10-08T15:48:43]i410: Variable: WixBundleElevated = 1
[0AC0:05E0][2013-10-08T15:48:43]i410: Variable: WixBundleInstalled = 1
[0AC0:05E0][2013-10-08T15:48:43]i410: Variable: WixBundleLog = C:\Users\A521064\AppData\Local\Temp\sLIM_Controller_(Bundle)_20131008154754.log
[0AC0:05E0][2013-10-08T15:48:43]i410: Variable: WixBundleLog_sLIMInstall.msi = C:\Users\A521064\AppData\Local\Temp\sLIM_Controller_(Bundle)_20131008154754_0_sLIMInstall.msi.log
[0AC0:05E0][2013-10-08T15:48:43]i410: Variable: WixBundleManufacturer = Atos IT Solutions and Services
[0AC0:05E0][2013-10-08T15:48:43]i410: Variable: WixBundleName = sLIM Controller (Bundle)
[0AC0:05E0][2013-10-08T15:48:43]i410: Variable: WixBundleOriginalSource = C:\Users\A521064\Desktop\sLIM_Bootstrapper.exe
[0AC0:05E0][2013-10-08T15:48:43]i410: Variable: WixBundleProviderKey = {cef60084-9565-4990-b3d6-2704a4475eab}
[0AC0:05E0][2013-10-08T15:48:43]i410: Variable: WixBundleRollbackLog_sLIMInstall.msi = C:\Users\A521064\AppData\Local\Temp\sLIM_Controller_(Bundle)_20131008154754_0_sLIMInstall.msi_rollback.log
[0AC0:05E0][2013-10-08T15:48:43]i410: Variable: WixBundleTag =
[0AC0:05E0][2013-10-08T15:48:43]i410: Variable: WixBundleVersion = 0.9.18.0
[0AC0:05E0][2013-10-08T15:48:43]i007: Exit code: 0x0, restarting: No
我的 MSI 中的 RegSearch 工作:
<Property Id="POSTGRESQLX64">
<RegistrySearch Id='PostgresqlX64RegSearch'
Root='HKLM'
Key='SOFTWARE\PostgreSQL\Installations\postgresql-x64-9.1'
Name="Version"
Win64="yes"
Type ="raw" />
</Property>
和日志:
AppSearch: Property: POSTGRESQLX64, Signature: PostgresqlX64RegSearch
MSI (c) (08:4C) [15:34:04:011]: Note: 1: 2262 2: Signature 3: -2147287038
MSI (c) (08:4C) [15:34:04:011]: PROPERTY CHANGE: Adding POSTGRESQLX64 property. Its value is '9.1.6.1'.
AppSearch: Property: POSTGRESQL_SERVICE, Signature: PostgresqlServiceRegSearch