Reputation:
I've got to silently run some cmd line on uninstall. I'm trying to use WixSilentExec but it does not work. What is the problem ?
<Property Id="WixSilentExecCmdLine" Value='cmd /C "rmdir /s/q [DataBaseDir]"' Hidden="yes"/>
<CustomAction Id="RemoveDataDir" BinaryKey="WixCA" DllEntry="WixSilentExec" Execute="immediate" Return="ignore"/>
<InstallExecuteSequence>
<Custom Action="RemoveDataDir" Before="RemoveFiles">DELETEDATADIR="1" OR FORCEDELETE="1") AND (NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")</Custom>
</InstallExecuteSequence>
<Directory Id="DataBaseDir" Name="$(var.DataBaseDirName)">
<Component Id="DataBaseDir.dir" Guid="*">
<CreateFolder/>
</Component>
</Directory>
Upvotes: 1
Views: 2174
Reputation:
The name cmd
can not be resolved and quoted executable name should be used instead :"cmd.exe"
SetProperty should be used as the installer can not resolve [DataBaseDir]
Sequence execute
should be set
<Property Id="RemoveDataDir" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="immediate" Return="ignore"/>
<SetProperty Id="WixQuietExecCmdLine" Before="RemoveDataDir" Sequence="execute" Value='"cmd.exe" /c rmdir /s/q "[DataBaseDir]"'>1</SetProperty>
Upvotes: 3