2014-01-23 134 views
0

我可以看到dll正在調用,它是在正確的時間正確的入口點,但沒有會話數據是空的。這讓我瘋狂!WIX自定義操作數據在安裝序列中爲空

請,任何人都有一個想法如何解決這個問題?

感謝

這裏是維克斯定義

<Binary Id="CustomActionBinary" SourceFile="$(var.BinariesForWix)blah.blah.CA.dll" /> 

    <CustomAction Id="OptionsFileFound" Return="check" Property="OptionsFileFound.Get" Value="file=[OPTIONSPATH],version=[INSTALLVERSION],ADVANCED=[ADVANCED],parmsetting=OPTIONSEXIST"/> 
    <CustomAction Id="OptionsFileFound.Get" BinaryKey="CustomActionBinary" DllEntry="OptionsFileFound" Execute="immediate" HideTarget="no" Return="check"/> 

    <InstallUISequence> 
     <!-- check if installation configuration file is present --> 
     <Custom Action ="OptionsFileFound.Get" After="MigrateFeatureStates"></Custom> 
     <Custom Action ="AbortError" After="OptionsFileFound.Get">NOT(OPTIONSEXIST="yes")</Custom> 
     <Custom Action ="InstallDatabaseList.Get" After="OptionsFileFound.Get"></Custom> 
    </InstallUISequence> 

,現在的C#代碼

 [CustomAction] 
    public static ActionResult OptionsFileFound(Session session) 
    { 
     FetchParms parmSet = new FetchParms(session); 

     fileLocation = parmSet.GetActData("file"); 
     version = parmSet.GetActData("version"); 
     olympicInstall = parmSet.GetActData("advanced"); 

     session.Log(string.Format("*************************************************  Looking for options file at {0}, version number should be {1}", fileLocation, version)); 

     string parmSetting = parmSet.GetActData("parmsetting"); 

     if (File.Exists(fileLocation)) 
     { 
      fileExists = true; 
      session.Log("*************************************************     found xml options file"); 
      LoadXmlToDictionary(fileLocation, session); 
      session.Log("*************************************************     loaded xml options file"); 
     } 
     else 
     { 
      fileExists = false; 
     } 

     session[parmSetting] = fileExists ? "yes" : "no"; 

     parmSet.Dispose(); 
     parmSet = null; 

     return ActionResult.Success; 
    } 

//獲取這裏PARMS類

 public FetchParms(Session session) 
    { 
     session.Log("************************************************* creating parameter dictionary"); 
     session.Log("************************************************* session data = " + session.CustomActionData.Count.ToString()); 
     CustomActionData parmSets = session.CustomActionData; 
     string parmString = parmSets.ToString(); 
     session.Log("************************************************* passed custom action data = " + session.CustomActionData.ToString()); 
     string[] eachParm = parmString.Split(new char[] { ';', ',' }, StringSplitOptions.RemoveEmptyEntries); 

     foreach (string theParm in eachParm) 
     { 
      string[] theOptions = theParm.Split(new char[] { '=' }); 

      this.parmList.Add(theOptions[0], string.IsNullOrEmpty(theOptions[1]) ? string.Empty : theOptions[1]); 
     } 
    } 

回答

1

CustomActionData是延期的客戶om行動。延遲自定義操作只能存在於InstallInitialize和InstallFinalize標準操作之間的InstallExecuteSequence中。嘗試在UI序列中使用它們是不正確的。

+0

如果不打擾您,請提供替代品! –

+1

請嘗試閱讀以下內容:http://www.installsite.org/pages/en/isnews/200108/ –

+0

這並不是說它「困擾」我......在UI序列中根本無法安排延遲的自定義操作。 MSI SDK不支持。 –

相關問題