自定义操作未运行

Ton*_*ile 2 custom-action wix

我已经为我的安装程序定义了一个自定义操作.安装程序似乎没有运行.

以下是WXS文件中定义自定义操作的行:

    <CustomAction Id="GetConfigProperties" BinaryKey="GetPropertiesDLL" DllEntry="GetPropertiesFromConfigFile" />

    <InstallExecuteSequence>
        <RemoveExistingProducts After="InstallInitialize" />
        <Custom Action="NewerVersionDetected" After="FindRelatedProducts">NEWERVERSIONDETECTED</Custom>
        <Custom Action="GetConfigProperties" After="FindRelatedProducts"></Custom>
        . . .            
    </InstallExecuteSequence>

    <Binary Id="GetPropertiesDLL" SourceFile="$(var.LPRCore Installer CBP Helper.TargetDir)\LPRCore Installer CBP Helper.CA.dll" />
Run Code Online (Sandbox Code Playgroud)

我用Orca检查了MSI,相应的条目在MSI表中.

以下是CustomActions.cs文件中代码的摘录:

    [CustomAction]
    public static ActionResult GetPropertiesFromConfigFile(Session session) {
        // Output a start message to the install log
        session.Log( "Begin GetPropertiesFromConfigFile" );

        . . .


        return ActionResult.Success;
    }
Run Code Online (Sandbox Code Playgroud)

代码中还有一些其他session.Log语句,我想看看发生了什么.

现在,我已启用日志记录.当我在记事本中查看日志文件时,我看不到来自我的调用的消息session.Log.我看不到任何一个引用GetConfigProperties.看来自定义操作根本没有执行.我做错了什么?

Ton*_*ile 5

事实证明自定义操作未运行,因为:

  1. 它计划在错误的地方运行.我的错,我需要把它放在InstallUISequence部分,而不是InstallSequence部分.

  2. 我在行动可以运行之前中止了安装.

当我将自定义操作放入InstallUISequence部分并在正确的位置时,一切运行正常.

谢谢你的尝试.

托尼