/build/static/layout/Breadcrumb_cap_w.png

Is there a way to force an MSI to fail with a specific error code?

If you attempt to install an application with ProductCode A and Package Code B but there is already an application installed with ProductCode A and PackageCode C, you get the following error code: 1638.  I have repackaged application X but the legacy version of application X exists on most of the machines in the environment right now.  My wrapper will take care of removing the legacy version before putting down the repackaged version, however, I would still like to put in a custom action that detects this legacy version and fails.  When it fails, I would like it to fail with 1638 not 1603.  Is there a way I can accomplish this?


0 Comments   [ + ] Show comments

Answers (3)

Posted by: pjgeutjens 12 years ago
Red Belt
3

unfortunately you have very little control over the exit code generated by an MSI installer Custom Action, and only a limited number of available 'choices'..

For more info on this see: http://msdn.microsoft.com/en-us/library/windows/desktop/aa369778%28v=vs.85%29.aspx

 

Posted by: piyushnasa 12 years ago
Red Belt
1

Run it using a script and return a code whatever you want.

Posted by: Rvlieburg 12 years ago
Third Degree Blue Belt
-1

use a batch script to install the msi

add the following line:

SET ERROR=%ERRORLEVEL%
IF "%ERROR%" == "1603" SET ERROR=1638 

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ