我可以看到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]);
}
}
答案 0 :(得分:1)
CustomActionData用于延迟自定义操作。延迟的自定义操作只能存在于InstallInitialize和InstallFinalize标准操作之间的InstallExecuteSequence中。试图在UI序列中使用它们是不正确的。