Condition it with "Installed" or something similar in that case (remember to account/test for repair, modify & patching/upgrading where applicable to your installer). e.g. <Custom Action="ExecuteSqlStrings" After="InstallInitialize">Installed</Custom> Might need to add stuff like "AND NOT REINSTALL" if you don't want it to run during repair/modify/patch/upgrade.
As I said open the original MSI in InstEd!/Orca & see what Condition it has already & then copy whatever the condition on it is to your code. MSDN page on sequence tables has some of that info in it -> http://msdn.microsoft.com/en-us/library/aa372404(v=VS.85).aspx It's not exhaustive as the examples don't have optional stuff like RemoveExistingProducts listed. Best place to look I've found is the WiX documentation pages for the Sequence Elements (e.g. http://wix.sourceforge.net/manual-wix3/wix_xsd_installexecutesequence.htm) however nowhere is going to list Custom Actions like ExecuteSqlStrings anyway so opening your MSI in InstEd!/Orca & looking at the tables is probably easier in this case. Palbinder Sandher Software Deployment & IT Administrator T: +44 (0) 141 945 8500 F: +44 (0) 141 945 8501 http://www.iesve.com **Design, Simulate + Innovate with the <Virtual Environment>** Integrated Environmental Solutions Limited. Registered in Scotland No. SC151456 Registered Office - Helix Building, West Of Scotland Science Park, Glasgow G20 0SP Email Disclaimer -----Original Message----- From: Nathan Zaugg [mailto:nza...@gmail.com] Sent: 03 June 2010 15:42 To: General discussion for Windows Installer XML toolset. Subject: Re: [WiX-users] Detach Databases on Uninstall Pally, That's close, but it doesn't work because it tries to run on install and I need it to run on uninstall. I knew it had to be some kind of InstallExecuteSequence, I just wasn't sure of the to make it work with uninstall. By the way, is there a list of these actions and install steps that I can reference? Thanks! Nate On Thu, Jun 3, 2010 at 5:52 AM, Pally Sandher <pally.sand...@iesve.com> wrote: > Couldn't you just reschedule the ExecuteSqlStrings action by adding it to the > InstallExecuteSequence with the appropriate Before="" or After="" attribute? > > That's how I worked around an issue with the SchedXMLConfig action before it > was modified to run after the DuplicateFiles action as it would error in a > pre-final build of WiX v3.0 if you tried to use XMLConfig on a CopyFile'd > file. Try something like: > > <InstallExecuteSequence> > <Custom Action="ExecuteSqlStrings" After="InstallInitialize" /> > </InstallExecuteSequence> > > You may want to pop your MSI open in InstEd!/Orca first to check the > InstallExecuteSequence & copy any Condition set on ExecuteSqlStrings into > your code. > > Palbinder Sandher > Software Deployment & IT Administrator > T: +44 (0) 141 945 8500 > F: +44 (0) 141 945 8501 > > http://www.iesve.com > **Design, Simulate + Innovate with the <Virtual Environment>** > Integrated Environmental Solutions Limited. Registered in Scotland No. > SC151456 Registered Office - Helix Building, West Of Scotland Science > Park, Glasgow G20 0SP Email Disclaimer > > > -----Original Message----- > From: dB. [mailto:dbl...@dblock.org] > Sent: 03 June 2010 12:13 > To: General discussion for Windows Installer XML toolset. > Subject: Re: [WiX-users] Detach Databases on Uninstall > > There's a set of immediate custom actions in http://msiext.codeplex.com that > you can schedule at will. The one you want is ODBCExecute. > > There's also a whole stack of Wix extensions for ODBC generically and SQL > server specifically if you decide that what's included in Wix doesn't do it > for you. > > cheers > dB. > > dB. @ dblock.org > Moscow|Geneva|Seattle|New York > > > -----Original Message----- > From: Nathan Zaugg [mailto:nza...@gmail.com] > Sent: Wednesday, June 02, 2010 7:07 PM > To: General discussion for Windows Installer XML toolset. > Subject: Re: [WiX-users] Detach Databases on Uninstall > > I think I now have some insight. The reason I can't connect is because WIX > detected that SQL Server was using a file that was included in the > installation and stopped SQL Server during the uninstall. > > Any idea how I coax it to running those scripts toward the beginning of the > uninstall? > > > > Action 17:02:12: ExecuteSqlStrings. Executing SQL Strings MSI (s) (F8:F4) > [17:02:12:349]: Executing op: > CustomActionSchedule(Action=ExecuteSqlStrings,ActionType=25601,Source= > BinaryData,Target=**********,CustomActionData=**********) > MSI (s) (F8:F4) [17:02:12:358]: Creating MSIHANDLE (44) of type 790536 for > thread 5108 MSI (s) (F8:6C) [17:02:12:359]: Invoking remote custom action. > DLL: > C:\Windows\Installer\MSIC91F.tmp, Entrypoint: ExecuteSqlStrings MSI > (s) (F8!80) [17:02:29:356]: Creating MSIHANDLE (45) of type 790531 for > thread 1152 > ExecuteSqlStrings: Error 0x80004005: continuing after failure to > connect to database: master MSI (s) (F8!80) [17:02:29:356]: Closing > MSIHANDLE (45) of type 790531 for thread 1152 MSI (s) (F8!80) > [17:02:29:357]: Creating MSIHANDLE (46) of type 790531 for thread 1152 > ExecuteSqlStrings: Error 0x80004005: continuing after failure to > connect to database: master MSI (s) (F8!80) [17:02:29:357]: Closing > MSIHANDLE (46) of type 790531 for thread 1152 MSI (s) (F8!80) > [17:02:29:357]: Creating MSIHANDLE (47) of type 790531 for thread 1152 > ExecuteSqlStrings: Error 0x80004005: continuing after failure to > connect to database: master MSI (s) (F8!80) [17:02:29:358]: Closing > MSIHANDLE (47) of type 790531 for thread 1152 MSI (s) (F8!80) > [17:02:29:358]: Creating MSIHANDLE (48) of type 790531 for thread 1152 > ExecuteSqlStrings: Error 0x80004005: continuing after failure to > connect to database: master MSI (s) (F8!80) [17:02:29:358]: Closing > MSIHANDLE (48) of type 790531 for thread 1152 MSI (s) (F8!80) > [17:02:29:358]: Creating MSIHANDLE (49) of type 790531 for thread 1152 > ExecuteSqlStrings: Error 0x80004005: continuing after failure to > connect to database: master MSI (s) (F8!80) [17:02:29:359]: Closing > MSIHANDLE (49) of type 790531 for thread 1152 MSI (s) (F8!80) > [17:02:29:359]: Creating MSIHANDLE (50) of type 790531 for thread 1152 > ExecuteSqlStrings: Error 0x80004005: continuing after failure to > connect to database: master MSI (s) (F8!80) [17:02:29:359]: Closing > MSIHANDLE (50) of type 790531 for thread 1152 MSI (s) (F8:6C) > [17:02:29:363]: Closing MSIHANDLE (44) of type 790536 for thread 5108 > > > On Tue, Jun 1, 2010 at 4:55 PM, Michael Osmond <mosm...@baytech.com.au> wrote: >> Hi >> >> Another option to trace this is to use SQL Profiler - it should show the >> calls being made and any errors occurring. >> >> By setting ContinueOnError="yes" any errors will be swallowed (they may be >> in the log). If you are doing this only to make the uninstall robust >> against the database not existing, perhaps you should wrap the detach >> process in a test of the database existing instead. >> >> Michael >> >> >> -----Original Message----- >> From: Pally Sandher [mailto:pally.sand...@iesve.com] >> Sent: Wednesday, 2 June 2010 4:12 AM >> To: General discussion for Windows Installer XML toolset. >> Subject: Re: [WiX-users] Detach Databases on Uninstall >> >> Try using "msiexec /i <msiname> /l*vx <logname>" to get verbose logs. >> >> I'm not sure on what info the WiX Standard Custom Actions like SqlExtension >> put into the logs but those options should get everything & might help point >> out where it's failing. For some reason I've got a feeling there is some >> Property or variable you may need to set to get the Standard Custom Actions >> to put more stuff into the logs, not 100% sure on that though & I can't find >> any reference to it anywhere so I might be mixing it up with something else. >> Hopefully if it does exist someone else will remember what I'm rambling >> about & clarify. >> >> Palbinder Sandher >> Software Deployment & IT Administrator >> T: +44 (0) 141 945 8500 >> F: +44 (0) 141 945 8501 >> >> http://www.iesve.com >> **Design, Simulate + Innovate with the <Virtual Environment>** >> Integrated Environmental Solutions Limited. Registered in Scotland No. >> SC151456 Registered Office - Helix Building, West Of Scotland Science >> Park, Glasgow G20 0SP Email Disclaimer >> >> -----Original Message----- >> From: Nathan Zaugg [mailto:nza...@gmail.com] >> Sent: 28 May 2010 19:58 >> To: wix-users@lists.sourceforge.net >> Subject: [WiX-users] Detach Databases on Uninstall >> >> I am trying to detach databases on uninstall. I know the commands I have >> work but for some reason this action fails. We're using integrated >> authentication and I wonder if that might be part of it. I have also tried >> running osql/sqlcmd as an install action. It didn't work either and it >> didn't give me anything interesting in the log. >> >> Any suggestions? If I run these commands from a command line they work fine. >> >> Thanks! >> Nate >> >> <sql:SqlDatabase Id="Master" Server="." Instance="SQLEXPRESS" >> Database="master" /> >> >> <sql:SqlString Id="OfflineQCEW" ContinueOnError="yes" >> ExecuteOnUninstall="yes" SqlDb="Master" SQL="ALTER DATABASE QCEW.Deploy SET >> OFFLINE WITH ROLLBACK IMMEDIATE" /> <sql:SqlString Id="DetachQCEW" >> ContinueOnError="yes" >> ExecuteOnUninstall="yes" SqlDb="Master" SQL="EXEC >> master.dbo.sp_detach_db @dbname = N'[iQFolder]\QCEW.Deploy.MDF'"/> >> >> <!--Detach QCEWCommon--> >> <sql:SqlString Id="OfflineQCEWCommon" ContinueOnError="yes" >> ExecuteOnUninstall="yes" SqlDb="Master" SQL="ALTER DATABASE QCEWCommon SET >> OFFLINE WITH ROLLBACK IMMEDIATE" /> <sql:SqlString Id="DetachQCEWCommon" >> ContinueOnError="yes" >> ExecuteOnUninstall="yes" SqlDb="Master" SQL="EXEC >> master.dbo.sp_detach_db @dbname = N'[iQFolder]\QCEWCommon.MDF'"/> >> >> <!--Detach QCEWSecurity--> >> <sql:SqlString Id="OfflineQCEWSecurity" ContinueOnError="yes" >> ExecuteOnUninstall="yes" SqlDb="Master" SQL="ALTER DATABASE QCEWSecurity SET >> OFFLINE WITH ROLLBACK IMMEDIATE" /> <sql:SqlString Id="DetachQCEWSecurity" >> ContinueOnError="yes" >> ExecuteOnUninstall="yes" SqlDb="Master" SQL="EXEC >> master.dbo.sp_detach_db @dbname = N'[iQFolder]\QCEWSECURITY.MDF'"/> >> >> >> Action 19:16:00: ExecuteSqlStrings. Executing SQL Strings >> ExecuteSqlStrings: Error 0x80004005: continuing after failure to >> connect to database: master >> ExecuteSqlStrings: Error 0x80004005: continuing after failure to >> connect to database: master >> ExecuteSqlStrings: Error 0x80004005: continuing after failure to >> connect to database: master >> ExecuteSqlStrings: Error 0x80004005: continuing after failure to >> connect to database: master >> ExecuteSqlStrings: Error 0x80004005: continuing after failure to >> connect to database: master >> ExecuteSqlStrings: Error 0x80004005: continuing after failure to >> connect to database: master >> >> >> >> --------------------------------------------------------------------- >> - >> -------- >> >> _______________________________________________ >> WiX-users mailing list >> WiX-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/wix-users >> >> --------------------------------------------------------------------- >> - >> -------- >> >> _______________________________________________ >> WiX-users mailing list >> WiX-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/wix-users >> > > ---------------------------------------------------------------------- > -------- ThinkGeek and WIRED's GeekDad team up for the Ultimate > GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. > See the prize list and enter to win: > http://p.sf.net/sfu/thinkgeek-promo > _______________________________________________ > WiX-users mailing list > WiX-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wix-users > > ---------------------------------------------------------------------- > -------- ThinkGeek and WIRED's GeekDad team up for the Ultimate > GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. > See the prize list and enter to win: > http://p.sf.net/sfu/thinkgeek-promo > _______________________________________________ > WiX-users mailing list > WiX-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wix-users > > > > ---------------------------------------------------------------------- > -------- ThinkGeek and WIRED's GeekDad team up for the Ultimate > GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental > unit. See the prize list and enter to win: > http://p.sf.net/sfu/thinkgeek-promo > _______________________________________________ > WiX-users mailing list > WiX-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wix-users > ------------------------------------------------------------------------------ ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------------ ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users