Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

how to copy file and then conditionally remove it


3 replies to this topic

TomekR

TomekR
  • Full Members
  • 6 posts

Posted 23 September 2010 - 06:50

Hi!

(I'm newbe in Installer world so I'm still not sure what is right what is wrong.)

I make a installer for service which uses desktop database. The database file should somehow be copied during first installation, be intact during upgrades and finally removed during uninstall.

As far I know, I can't add the database file as a directory component - 'cause installer will automatically remove it during uninstall. On the other hand, if I set the Persistent attribute, the database file will be NEVER removed by installer.
The above leads me to thinking, that I can't add the database file as directory's component. So what are other options? Is it possible to include a file into installer file (msi) and then copy the file with custom action to target folder? Then deletion could be solved with RemoveFile element (Wix) and condition based on UPGRADINGPRODUCTCODE property.

What do you think, guys?


Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 23 September 2010 - 08:00

You could include your database as a regular component, but make sure the RemoveExistingProducts action is scheduled late in the sequence, so that the new version gets installed before the old version is removed. Since your database is required by the new version it should stay installed.

TomekR

TomekR
  • Full Members
  • 6 posts

Posted 23 September 2010 - 11:56

Stefan, thx for your reply.

QUOTE (Stefan Krueger @ 2010-09-23 08:00)
>You could include your database as a regular component, but make sure the RemoveExistingProducts action is scheduled late in the sequence, so that the new version gets installed before the old version is removed. Since your database is required by the new version it should stay installed.


I can't allow to remove database file during upgrade, as the file includes data which must be kept during application whole live.
If the new version of app requires new version of database, that is another story...

My question is rather: how it is possible to include a file in msi and then copy it to target folder without making it a component?
I read some discussions about using ziped content etc. Is it the only way?

I've been thinking about including the file somehow :-) in the msi and then placing in on the target by some standard custom action.
Is it possible?

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 24 September 2010 - 11:48

I wasn't talking about a new version of the datebase. But if both version 1.0 of your application and version 2.0 of your application include the database component and feature, it should automatically stay installed - but only iof you select "install new version first, then delete unused files".

If you install the database using a custom action, or mark the component as permanent, or use a blank component code, the result is always the same: it will not be deleted even during uninstall of your application. This might be acceptable (databse condidered as being user data), or you could delete it using a custom action.