Search code examples
wixcmdexecutioncustom-action

What's wrong with my custom Action?


I've tried tons of times to try to use a custom action just to simply copy a file to another place. I do think this should be easily worked, but... I was frustrated that it is always failed!

I post my code and the error log, please any one kindly enough to point me the way out... Thank you in advance!!

   <CustomAction Id="QtExecCopyPropertyFileCmd"
                 Property="QtExec64CmdLine" 
                 Value="&quot;[SystemFolder]cmd.exe&quot; /c copy &quot;C:\Program Files\AptWare\AptWare View\Server\broker\webapps\portal\WEB-INF\classes\portal-links.properties&quot; &quot;C:\ProgramData\AptWare\VDM&quot;"/>
  <CustomAction Id="QtExecCopyPropertyFile"
                BinaryKey="WixCA"
                DllEntry="CAQuietExec64"
                Execute="immidiate"
                Return="check"/>

And here is my action sequence:

 <InstallExecuteSequence>
     <Custom Action='SetOldPortalLinkFile' After='InstallInitialize'>NOT (Installed OR PORTALLINKFILEEXISTS) AND OLDPORTALLINKFILEEXISTS</Custom>
     <Custom Action='SetPortalLinkFileDestFolder' After='SetOldPortalLinkFile'>NOT (Installed OR PORTALLINKFILEEXISTS) AND OLDPORTALLINKFILEEXISTS</Custom>
     <Custom Action="QtExecCopyPropertyFileCmd" After="SetPortalLinkFileDestFolder">NOT (Installed OR PORTALLINKFILEEXISTS) AND OLDPORTALLINKFILEEXISTS</Custom>
     <Custom Action="QtExecCopyPropertyFile" After="QtExecCopyPropertyFileCmd">NOT (Installed OR PORTALLINKFILEEXISTS) AND OLDPORTALLINKFILEEXISTS</Custom>

And some approach I've tried:

  1. I do not think this is due to quto, or file/dir existence, from the log I copied the generated cmd running in a cmd shell it works
  2. It is not related with 32bit or 64bit CA, I tried both 32 and 64 bit. All same failure.
  3. I am not sure if this relate with privilege, but if I try deferred CA, still I got error... And in my scenario I need a immediate CA because the copied file will be removed during uninstall previous version. So I need it run before InstallFinalized

The last, error log:

操作 6:22:34: QtExecCopyPropertyFileCmd。

操作开始 6:22:34: QtExecCopyPropertyFileCmd。

MSI (s) (90:88) [06:22:34:743]: Transforming table CustomAction.

MSI (s) (90:88) [06:22:34:743]: PROPERTY CHANGE: Adding QtExec64CmdLine property. Its value is '"C:\Windows\SysWOW64\cmd.exe" /c copy "C:\Program Files\AptWare\AptWare View\Server\broker\webapps\portal\WEB-INF\classes\portal-links.properties" "C:\ProgramData\AptWare\VDM"'.

操作结束 6:22:34: QtExecCopyPropertyFileCmd。返回值 1。

MSI (s) (90:88) [06:22:34:743]: Doing action: QtExecCopyPropertyFile

操作 6:22:34: QtExecCopyPropertyFile。

操作开始 6:22:34: QtExecCopyPropertyFile。

MSI (s) (90:88) [06:22:34:746]: Transforming table CustomAction.

MSI (s) (90:98) [06:22:34:748]: Invoking remote custom action. DLL: C:\Windows\Installer\MSIB138.tmp, Entrypoint: CAQuietExec64

MSI (s) (90:2C) [06:22:34:762]: PROPERTY CHANGE: Deleting QtExec64CmdLine property. Its current value is '"C:\Windows\SysWOW64\cmd.exe" /c copy "C:\Program Files\AptWare\AptWare View\Server\broker\webapps\portal\WEB-INF\classes\portal-links.properties" "C:\ProgramData\AptWare\VDM"'.

CAQuietExec64:  Error 0x80070001: Command line returned an error.

CAQuietExec64:  Error 0x80070001: CAQuietExec64 Failed

CustomAction QtExecCopyPropertyFile returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)

Solution

  • I go the answer now. http://sharp-gamedev.blogspot.com/2009/07/wix-again.html

    In above link, clearly, CAQuietExec must have some bugs to support build in dos command such as copy, ren, del etc. However, use xcopy.exe instead of copy it work, I tested, it really work. I think for ren or del can find other substitutions as well.

    What a big trap for me!!

    Thanks all the kindly replied!