我已閱讀的鏈接後,寫了這個代碼來獲取安裝位置屬性: http://blogs.technet.com/b/alexshev/archive/2008/03/25/property-does-not-exist-or-empty-when-accessed-from-deferred-custom-action.aspx無法在遞延自定義操作
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Module Id="MergeModule1" Language="1033" Version="1.0.0.0">
<Package Id="cffa568e-1bf0-4eb3-bee3-eb5801a0bbd0" Manufacturer="Microsoft" InstallerVersion="200" />
<Binary Id="myCustomActionsDLL" SourceFile="CustomAction1.CA.dll" />
<CustomAction Id="SetProperty" Execute="immediate"
Property="CA_myCustomAction"
Value="InstallDir=[PRIMARYFOLDER];SourceDir=[SourceDir]" />
<CustomAction
Id="CA_myCustomAction"
BinaryKey="myCustomActionsDLL"
DllEntry="CustomAction1"
Execute="deferred" Impersonate="no"
Return="check" />
<InstallExecuteSequence>
<Custom Action="SetProperty" Before="InstallInitialize">Not Installed</Custom>
<Custom Action="CA_myCustomAction" Before="InstallFinalize">Not Installed</Custom>
</InstallExecuteSequence>
<!--<InstallUISequence>
<Custom Action="CA_myCustomAction" After="CostFinalize"></Custom>
</InstallUISequence>-->
</Module>
</Wix>
在地方InstallDir - PRIMARYFOLDER
,我曾嘗試 - INSTALLLOCATION,INSTALLDIR,TARGETDIR但我我無法獲取爲ProgramFiles(x86)下的應用程序指定的安裝文件夾。
SourceDir
的值是在MSI文件運行時找到的正確值。
非常感謝!似乎沒有人知道除了你以外的其他人。你能給我提供一個例子或指針在互聯網上使用MergeRedirectFolder或SuppressModularization? – teenup
MergeRedirectFolder的更新示例。我不能在這裏顯示的部分是,當您將合併模塊添加到InstallShield時,您必須右鍵單擊它並使用下拉列表將合併模塊與INSTALLDIR關聯。 –
謝謝,我會在星期一嘗試。非常感謝。 – teenup