如何在wix中将属性传递给回滚自定义操作?

时间:2013-12-19 18:41:36

标签: wix wix3.7

我有一对自定义操作,可以将一些已弃用的文件移动到临时目录,另一个自定义操作可以在安装程序回滚以将其放回时运行。我必须使用自定义操作,因为之前的安装程序是installshield。

以下是我的自定义操作:

<CustomAction Id="DeleteUserAdminDeprecatedFiles" BinaryKey="FileSearchCA" DllEntry="DeleteUserAdminDeprecatedFiles" Execute="immediate" Return="check" />

    <CustomAction Id="RestoreDeprecatedFiles"
                  BinaryKey="FileSearchCA"
                  DllEntry="RestoreDeprecatedFiles"
                  Execute="rollback"
                  Return="ignore"
              />

    <CustomAction Id="SetRollbackData" Property="RestoreDeprecatedFiles" Value="RootDir=[DEPRECATEDFILESROOTDIR];TempDir=[DEPRECATEDTEMPORARYDIR]" Execute="immediate" Return="ignore"/>

以下是这些行动的安排:

            <Custom Action="SetRollbackData" After="DeleteUserAdminDeprecatedFiles">
            OLD_VERSION_FOUND OR                        <!--Run if we are doing a major upgrade (msi -> msi).-->
            REMOVEINSTALLSHIELD
        </Custom>
        <Custom Action="DeleteUserAdminDeprecatedFiles" Before="InstallFinalize">
            OLD_VERSION_FOUND OR                        <!--Run if we are doing a major upgrade (msi -> msi).-->
            REMOVEINSTALLSHIELD                         <!--Run if we are upgrading installshield instance.-->
        </Custom>
        <Custom Action="RestoreDeprecatedFiles" After="InstallInitialize"/>

然后在日志中我得到:

MSI (s) (04:74) [11:31:22:162]: Doing action: DeleteUserAdminDeprecatedFiles
Action 11:31:22: DeleteUserAdminDeprecatedFiles. 
Action start 11:31:22: DeleteUserAdminDeprecatedFiles.
MSI (s) (04:3C) [11:31:22:171]: Invoking remote custom action. DLL: C:\Windows\Installer\MSI8804.tmp, Entrypoint: DeleteUserAdminDeprecatedFiles
SFXCA: Extracting custom action to temporary directory: C:\Windows\Installer\MSI8804.tmp-\
SFXCA: Binding to CLR version v4.0.30319
Calling custom action FileSearchCA!FileSearchCA.FileSearchCA.DeleteUserAdminDeprecatedFiles
Starting UserAdmin delete deprecated files Custom Action.
MSI (s) (04!50) [11:31:22:376]: PROPERTY CHANGE: Adding DEPRECATEDFILESROOTDIR property. Its value is 'C:\Program Files\Duck Creek Technologies\ExampleUserAdmin\bin'.
MSI (s) (04!50) [11:31:22:380]: PROPERTY CHANGE: Adding DEPRECATEDTEMPORARYDIR property. Its value is 'C:\Users\LMUser\AppData\Local\Temp\t3n1evfp.dwa'.
Action ended 11:31:22: DeleteUserAdminDeprecatedFiles. Return value 1.
MSI (s) (04:74) [11:31:22:429]: Doing action: SetRollbackData
Action 11:31:22: SetRollbackData. 
Action start 11:31:22: SetRollbackData.
MSI (s) (04:74) [11:31:22:437]: Note: 1: 2723 2: SetRollbackData 
DEBUG: Error 2723:  Custom action SetRollbackData specifies unsupported type

任何帮助解决此问题都将非常感激。

1 个答案:

答案 0 :(得分:0)

我是个白痴我修好了。

我不得不改变:

<CustomAction Id="SetRollbackData" Property="RestoreDeprecatedFiles" Value="RootDir=[DEPRECATEDFILESROOTDIR];TempDir=[DEPRECATEDTEMPORARYDIR]" Execute="immediate" Return="ignore"/>

要:

<CustomAction Id="SetRollbackData" Property="RestoreDeprecatedFiles" Value="RootDir=[DEPRECATEDFILESROOTDIR];TempDir=[DEPRECATEDTEMPORARYDIR]" />