我的MSI安裝需要是兩相。在第一個我收集來自用戶的數據,並在第二個我想運行實際安裝使用第一階段收集的值。第二階段需要在高架環境下運行。Wixsharp - 從ManagedAction傳遞值ElevatedManagedAction
我在網絡上發現,將值傳遞給高架遞延行動的唯一方法是設置屬性。在MSDN文章中(以及在網絡上的一些示例中),據說我需要
- set屬性[命名與被緩存動作的「主鍵」相同) - 要傳遞的值到達被推遲的行動。具體來說,該值可以採用鍵=值字符串格式的形式,重複和以分號分隔。
- 在使用索引(通過鍵)的作用遞延取的值。
我開始用行動定義:
project.Actions = new []
{
new ManagedAction(InstallerActions.LiveBankInstallPrepare, Return.check, When.After, Step.InstallExecute,
Condition.Always, Sequence.InstallExecuteSequence)
{
ActionAssembly = "%this%",
Name = "Preparing installation",
},
new ElevatedManagedAction(InstallerActions.LiveBankInstallExecute, Return.check, When.After, Step.InstallExecute,
Condition.Always, Sequence.InstallExecuteSequence)
{
ActionAssembly = "%this%",
Name = "Executing installation",
Id = "ABCD"
},
};
在收集的第一個行動的數據我其存儲在一個名爲一樣的遞延行動的ID屬性
propertyDict = BuildSemicolonSeparatedDict();
session["ABCD"] = propertyDict;
//在運行時propertyDict是如execMode = InstallForced;超時= 5
,我有這樣的問題:
什麼我做錯了,我不能在遞延行動見第一步(動作)分配propertyDict。
var execMode = session.CustomActionData["execMode"];
//key not found in the dictionary, however propertyDict built in the first action contains it.
我想我必須傳遞值錯誤,當我靜態設置的操作參數與UsesProperties財產,我可以看到在遞延行動的鍵值對。