Mike de Klerk
Mike de Klerk

Reputation: 12328

WiX custom action, run EXE, error code 1721

I have read many of the examples on the Internet, but I cannot figure out what is going wrong. I have a WiX installer that copies all MySQL server files to a certain location on install. Then I want to run MySQLInstanceConfig.exe before the setup ends.

<CustomAction Id="CAConfigureMySqlInstance"
              Directory="dir96BE76D0898DC48E62BC8465D43A5949"
              Impersonate="no"
              Execute="commit"
              ExeCommand="[dir96BE76D0898DC48E62BC8465D43A5949]MySQLInstanceConfig.exe"
              Return="check"
/>

<InstallExecuteSequence>
    <Custom Action='CAConfigureMySqlInstance' After='InstallFiles' />

    <!-- See this for Before/After sequence moments: http://msdn.microsoft.com/en-us/library/windows/desktop/aa371199(v=vs.85).aspx -->

</InstallExecuteSequence>

I assume that After='InstallFiles' really is after all the files have been put at the right locations by the installer. Now I see the progressbar go at 'Copying new files' in the installer. Then I get a message 'A program required for this install to complete could not be run'. When I look at the log file, I see this:

MSI (s) (54:94) [14:14:32:886]: Note: 1: 1721 2: CAConfigureMySqlInstance 3: C:\Program Files (x86)\MyCompnay\MySQL\MySQL Server 5.5\bin\ 4: C:\Program Files (x86)\MyCompany\MySQL\MySQL Server 5.5\bin\MySQLInstanceConfig.exe

Whenever I copy that path in 'Run (Windows +R)', the MySQL configurator is run! So the path is correct. And so I conclude that on the moment of the error, the file is already copied to that location! The error code is 1721.

Whenever I change the ExeCommand to C:\Windows\Explorer.EXE C:\SomeDirIKnow, Windows Explorer is launched... So the custom action seems about right...

How do I fix this problem?

Upvotes: 2

Views: 2440

Answers (1)

Mike de Klerk
Mike de Klerk

Reputation: 12328

I run it as

<CustomAction Id="CAConfigureMySqlInstance" 
              Directory="dir96BE76D0898DC48E62BC8465D43A5949"
              Impersonate="no"
              Execute="deferred"
              ExeCommand='"[dir96BE76D0898DC48E62BC8465D43A5949]MySQLInstanceConfig.exe"'
              Return="check"
/>

<InstallExecuteSequence>
  <Custom Action='CAConfigureMySqlInstance' Before='InstallFinalize' />
  <!-- See this for Before/After sequence moments: http://msdn.microsoft.com/en-us/library/windows/desktop/aa371199(v=vs.85).aspx -->
</InstallExecuteSequence>

Note the quotes used ExeCommand='" => that is single, double, location of exe, double, single.

Ridiculous! Spent more than 1 hour on this!

Upvotes: 7

Related Questions