Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wix error 1721 related to CustomAction

I have following CostomAction

<Binary Id='ManualsBat' SourceFile='bin\Debug\test.bat' />

<CustomAction 
  Id="manuals"
  BinaryKey="ManualsBat"
  ExeCommand="[SourceDir]Manuals &quot;[Agent]Manuals&quot;"
  Execute="immediate"
  Return="check" />

test.bat contains the following lines :

@echo off
echo Hello this a test batch file
pause
mkdir %2
copy %1 %2

What it is basically intended to do is, when the installer is run, the batch file needs to get executed. The batch file has to create a new directory "[Agent]Manuals" and it has to copy all the files from [SourceDir]Manuals to [Agent]Manuals.

When I builds .wxs it does not give any error bur when I run the .msi then it complains of the following in the log files

Error 1721. There is a problem with this Windows Installer package. A program required for this install to complete could not be run. Contact your support personnel or package vendor. Action: manuals, location: C:\Windows\Installer\MSI1F50.tmp, command: C:\dev\CD\Agent\pd\components\link\source\Link\Installer\WiX\WiX\bin\Debug\Manuals "D:\Cam\city\Agent\Manuals

Has anyone had experience with this kind of error. It will be great if someone can help me resolve this.

like image 754
sanam_bl Avatar asked Dec 15 '22 20:12

sanam_bl


2 Answers

Most likely your custom action needs Administrator privileges. Try setting Execute attribute to deferred and Impersonate to no. Please note that these options require the action to be scheduled after InstallFinalize standard action.

like image 194
rmrrm Avatar answered Dec 28 '22 17:12

rmrrm


Maybe problem in quotes. Change in ExeCommand quotes. Try this:

<Binary Id='ManualsBat' SourceFile='bin\Debug\test.bat' />

<CustomAction 
  Id="manuals"
  BinaryKey="ManualsBat"
  ExeCommand='"[SourceDir]Manuals" "[Agent]Manuals"'
  Execute="deferred"
  Impersonate="no"
  Return="check" />

<InstallExecuteSequence>
  <Custom Action="manuals" Before="InstallFinalize">Not Installed</Custom>
</InstallExecuteSequence>
like image 41
Sergik666 Avatar answered Dec 28 '22 19:12

Sergik666