user3191941
user3191941

Reputation: 33

How to keep command prompt open for Wix installer

The last step of our wix installer is to run SQLUpgrade.exe in command prompt to keep DB schema updated.

    <CustomAction Id="SQLPackageUpgrade" ExeCommand="start [SQLPackageLOCATION]SqlPackage.exe /Action:Publish /SourceFile:&quot;[SQLPackageLOCATION]XXX.dacpac&quot; /TargetConnectionString:&quot;Server=[DBSERVER];Database=[DBNAME]&quot;" Directory="SQLPackageLOCATION" Execute="deferred" Return="asyncNoWait"/>

With above code, command prompt disappears immediately at the time command exit. If the execution get failed, we won't able to see the error message showed in command prompt. We tried port the result to a txt file but it logs nothing. Is there a simple way to keep this command prompt open for customer so they can take the chance to see error message? Thanks!

Upvotes: 0

Views: 522

Answers (2)

Yan Sklyarenko
Yan Sklyarenko

Reputation: 32270

Instead of calling the EXE directly in a custom action, it is recommended to use Quiet Execution custom action for this.

The benefits are:

  • the console window won't blink during installation, it will simply not be visible. This is a poor user experience
  • the installation log file will contain all the info about the actual error

You have correctly scheduled the custom action as deferred - custom actions which change the target system must be deferred.

And last, but not the least: you should think about the rollback custom action and schedule it appropriately. Every deferred CA should have corresponding rollback CA - otherwise if installation fails and rolls back it might leave the system in undefined state.

Upvotes: 1

AltF4_
AltF4_

Reputation: 2470

I think in this case you need to change two of the attributes of your custom action:

Execute="immediate" Return="check"

Check means you want the results, so if it fails it might stop but at least you should able to see it.

You can alternatively try:

Return="asyncWait"

Hope this helps.

Upvotes: 0

Related Questions