PDA

View Full Version : Can this be right !



jonathanqis
09-28-2012, 09:49 AM
I have an Installscript MSI project.
During the uninstall it appears that it calls through 'OnRMFilesInUse'
before it executes the SQL scripts I have marked to run on un-install.
Consequently I still have a dll loaded by SQL Server and so it is listed in the processes it wishes to be stopped.
If I let this go 'as is' it errors in trying to connect to the SQL server and rolls back the uninstall.
I don't expect the users to be smart enough to stop the associated service we run (before running the uninstall), therfore, I wish to try to run the sql scripts earlier in the uninstall sequence.

I can not see a way to do this on the SQL Scripts panel (you either run it at uninstall or you don't).

I tried to call 'SQLRTComponentUninstall', but it is not recognised.
Apparently this functionality is not available to Installscript MSI projects.

N.B. though I also use 'SQLRTInitialize2' in the install and the help just says they are available to Installscript projects in both cases !

So...

Does anyone have any ideas as to how I can invoke my uninstall sql scripts sooner in the uninstallation

Or

How to override the functionality around 'SdRMFilesInUse' to remove the SQL server as a process to be stopped ?

And I thought this should be so easy !

jonathanqis
10-01-2012, 03:54 AM
Does anyone know of a way of running sql scripts at a time of their making during an uninstall of an Installscript MSI project ?

Ok, after some playing around I believe I can move the CA 'ISSQLServerUninstall' from it's usual position in the running order, forward to just after 'ISSQLServerRollback'.

This appears to execute my SQL uninstall scripts before the uninstall tries to remove the DLL I have loaded in SQL Server.
During the uninstall scripts I unload the DLL from SQL Server and remove the xp's it has registered. Thus I don't need to stop the SQL Server to remove the dll from the HDD.

Does anyone know what (if any) functionality is carried out in 'ISSQLServerUninstall' by default and whether it is liable to cause problems by moving this CA further forward in the execute sequence ?