lidds
Posts: 44
Joined: Thu Jun 14, 2012 11:22 pm

Do bot uninstall some files...

When my application is installed it installs SQL Server and attaches a couple of SQL Databases to the installed instance. When my application is uninstalled I am going to modify the installer to ask the user to select if they want the databases to be deleted on uninstall. If the use says NO e.g. they want to keep the database files as there could be data they wish to keep, how do I modify AdvancedInstaller to not delete these files??

Thanks

Simon
CiprianComsa
Posts: 110
Joined: Thu Aug 19, 2010 10:11 am
Contact: Website

Re: Do bot uninstall some files...

Hi Simon,

A solution could be to condition SQL scripts (which contains dropping database script from an instance of SQL Server) execution at uninstall.
This condition can consist of a public property which is associated with an UI control( e.g. CheckBox ). In this way the scripts will be executed only if the condition is true( e.g. CheckBox is enabled by the user ).
You can set the condition on sql script properties from SQL Script page on Script Execution section. Also, you must check only the option "at uninstall" from "Run SQL Script".

Please note, dropping a database deletes the database from an instance of SQL Server and deletes the physical disk files used by the database.

if you don't use the first solution you can use another one: file removal feature.
You can specify a condition for the removal operation for each database files. You can read "How do I remove a file or a folder during installation?" to understand how you can use file removal feature.

Regards,
Ciprian
__________________________________________________________________________________________________________________________________________________
Ciprian Comsa
Advanced Installer Team
http://www.advancedinstaller.com/
Ciprian Comsa - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
lidds
Posts: 44
Joined: Thu Jun 14, 2012 11:22 pm

Re: Do bot uninstall some files...

Hi Ciprian,

Thank you for your response, however I don't think this is exactly what I need. I will explain a bit more.

At the moment my Advanced Installer installs the SQL database files and attaches the databases to SQL, which is fine. The problem that I have is that because advanced installer installed the database files during install, it expects to delete these database files on uninstall. What I want to do is add an option that the user can select NOT to uninstall these database files on uninstall, therefore I need a way of allowing advanced installer to uninstall all files apart from 2 specific database files.

Hopefully that makes sense.

Simon
CiprianComsa
Posts: 110
Joined: Thu Aug 19, 2010 10:11 am
Contact: Website

Re: Do bot uninstall some files...

Hi Simon,

Can you please tell me how exactly did you install the database? Did you create the database by executing a SQL Script or copy all file types of database?

Regards,
Ciprian
__________________________________________________________________________________________________________________________________________________
Ciprian Comsa
Advanced Installer Team
http://www.advancedinstaller.com/
Ciprian Comsa - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
lidds
Posts: 44
Joined: Thu Jun 14, 2012 11:22 pm

Re: Do bot uninstall some files...

I actually copied the database files and then executed a VB.Net exe file that I have created to attach the databases and create user logins.

I suppose I could always look at running a SQL script to create the databases, but as I am on a deadline I would prefer to look at this next time round

Thanks

Simon

Return to “Building Installers”