Reputation: 33
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:"[SQLPackageLOCATION]XXX.dacpac" /TargetConnectionString:"Server=[DBSERVER];Database=[DBNAME]"" 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
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:
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
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