2011-04-18 45 views
6

我讀過How do I pass msiexec properties to a WiX C# custom action?,但這並沒有回答我的問題,或者我只是沒有看到我做錯了什麼。 我的安裝包無法安裝,並且日誌說我的屬性在自定義操作集合中找不到。我的代碼是:無法將屬性傳遞給WiX自定義動作

<CustomAction Id="SetCustomActionDataValue" Return="check" Property="Itp.Configurator.WixCustomAction" Value="G=G2" /> 
    <CustomAction Id="CreateDatabase" BinaryKey="Binary1" DllEntry="CreateDatabase" Execute="deferred" Return="check" /> 
    <InstallExecuteSequence> 
     <Custom Action='SetCustomActionDataValue' After="InstallFiles"/> 
     <Custom Action='CreateDatabase' After="SetCustomActionDataValue"> 
      NOT Installed AND NOT PATCH 
     </Custom> 
    </InstallExecuteSequence> 

和代碼中的自定義動作是:

string Property1 = session.CustomActionData["G"]; 

回答

6

在你的第一個元素屬性的名稱必須是完全一樣的遞延自定義操作你」的名義d喜歡將價值傳遞給。所以,如果推遲操作是CreateDatabase,那麼第一個元素應該看起來像這樣:

<CustomAction Id="SetCustomActionDataValue" Return="check" Property="CreateDatabase" Value="G=G2" /> 
相關問題