I have a Visual Studio setup and deployment project that runs a couple executables after the commit custom action. The installer fails with this error: "There is a problem with this Windows Installer package. A program run as part of the setup did not finish as expected. Contact your support personnel or package vendor." even though the programs that were run in the custom action have succeeded in doing what they were supposed to do.
What can I do to prevent this error?
There's only one way to find out that a process 'did not finish as expected'. The process exit code is non-zero. Set by the return value of main() in a native program. Or the value passed to Environment.Exit() in a managed program. Or the errorlevel in a batch file. It is automatically set to the exception code if the main thread of the process dies.
You'll have to find out why one of these programs returns a non-zero exit code.