DropOnUninstall not dropping database in SqlDatabase tag

1

I am creating a WiX installer for a product and it requires creating a database and some tables is MSSQL. Everything seems to install just fine but nothing is being dropped upon uninstall.

Here is the section where all the creation happens (changed to generic names):

<sql:SqlDatabase Id="CoreDatabase" Server="[ComputerName]" Instance="[SQLINSTANCES]" Database="CORE" 
                     CreateOnInstall="yes" DropOnUninstall="yes" ContinueOnError="yes">
<!-- Add individual tables -->
<sql:SqlScript Id="CreateTable1" ExecuteOnInstall="yes" ContinueOnError="yes" BinaryKey="Table1" />
<sql:SqlScript Id="CreateTable2" ExecuteOnInstall="yes" ContinueOnError="yes" BinaryKey="Table2" />
<sql:SqlScript Id="CreateTable3" ExecuteOnInstall="yes" ContinueOnError="yes" BinaryKey="Table3" />
<sql:SqlScript Id="CreateTable4" ExecuteOnInstall="yes" ContinueOnError="yes" BinaryKey="Table4" />
<sql:SqlScript Id="CreateTable5" ExecuteOnInstall="yes" ContinueOnError="yes" BinaryKey="Table5" />
<sql:SqlScript Id="CraeteTable6" ExecuteOnInstall="yes" ContinueOnError="yes" BinaryKey="Table6" />
<sql:SqlScript Id="CreateTable7" ExecuteOnInstall="yes" ContinueOnError="yes" BinaryKey="Table7" />
<sql:SqlScript Id="CreateTable8" ExecuteOnInstall="yes" ContinueOnError="yes" BinaryKey="Table8" />
</sql:SqlDatabase>

As I said, the "Core" database is created, and all tables are created on install. When I go to uninstall though nothing is dropped, if I go into SQL Server Management Studio everything is still there.

Here is the output from the MSI Log, it didn't seem to give me much useful information though.

MSI (s) (B4:74) [13:28:44:865]: Executing op: ActionStart(Name=DropDatabase,Description=Dropping Databases,)
MSI (s) (B4:74) [13:28:44:867]: Executing op: CustomActionSchedule(Action=DropDatabase,ActionType=25601,Source=BinaryData,Target=**********,CustomActionData=**********)
MSI (s) (B4:5C) [13:28:44:875]: Invoking remote custom action. DLL: C:\Windows\Installer\MSI3217.tmp, Entrypoint: DropDatabase
DropDatabase:  Error 0x80004005: failed to drop to database: 'CORE', error: unknown error
MSI (s) (B4!E4) [13:29:16:108]: Product: Core -- Error 26202. Error -2147467259: failed to drop SQL database: CORE, error detail: unknown error.

MSI (c) (C4:6C) [13:29:02:518]: Font created.  Charset: Req=0, Ret=0, Font: Req=MS Shell Dlg, Ret=MS Shell Dlg

Error 26202. Error -2147467259: failed to drop SQL database: CORE, error detail: unknown error.
CustomAction DropDatabase returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
wix
wix3.11
asked on Stack Overflow Mar 8, 2019 by netadptr0719

1 Answer

1

hResult 0x80004005 is an unspecified error. There isn't enough information here to be certain of the cause. I'd suspect permissions or database locks.

I personally don't drop databases on uninstall. They contain user data and can be cleaned up manually if user knows that they don't need it anymore.


User contributions licensed under CC BY-SA 3.0