我的程序應該安裝到記錄在註冊表中的路徑。如果找不到註冊表項,請安裝到另一個(默認)路徑。WiX - 如果註冊表搜索失敗,我如何安裝到備用路徑
例如,我想有這樣的:
<Property Id="MYINSTALLDIR">
<RegistrySearch Id='MyRegistry' Type='raw' Root='HKCU' Key='Software\MyApp\Foo' Name='InstallDir' />
if not found, then set "MYINSTALLDIR" to "D:\working\defaultApps"
</Property>
我應該怎麼寫我的WXS文件來實現這一目標?
編輯:
現在的問題是:
if not found in registry, then set "MYINSTALLDIR" to LocalAppDataFolder
我試圖
<Property Id="MYINSTALLDIR" Value="LocalAppDataFolder">
<RegistrySearch Id='MyRegistry' Type='raw' Root='HKCU' Key='Software\MyApp\Foo' Name='InstallDir' />
</Property>
但錯誤返回:
Error 1606. Could not access network location LocalAppDataFolder.
參見如何根據條件設置屬性這樣的回答:http://stackoverflow.com/questions/1690162/ wix-set-a-property-based-a-condition – BryanJ 2012-08-08 20:17:56