Hello,
I apologize for my delayed reply.
For the first part of my question, I do not want to use SQL script to maintain my database schema. Rather, I would like to use MS's dacpac system: these are XML documents describing the expected database schema. The local tool then compares that schema with the existing DB and performs the necessary adjustment. It allows for easy update of the schema no matter what the original state the database was in (or deploying a new one).
For this you can simply add your .dacpac file under the desired
directory path from
"Files and Folders" page. Also, if you need to call a specific tool (e.g.
SqlPackage.exe) to deploy or update your database schema then you can use a
custom action (it should be added as deferred after the "Install Execution Stage -> Add Resources" actions group). For example you can use our
"Launch File" predefined custom action.
First scenario: database schema and data
- User install product version 1. This will setup some database using schema version 1
- User adds data to the database.
- Users wants to update to version 1.1 which requires a schema update. Since it's a reinstall, the second step of the installation (install) should know that it should update existing data and not setup a new database.
Please keep in mind this is the normal behavior when using the
"Uninstall old version first and then install new version" option from
"Upgrades" page. In this case, during an upgrade installation first it will be removed the old version of your product (during
"RemoveExistingProducts" standard action) and afterwards it will be installed the new version. In order to preserve an installed file you should use the approach exposed in our
"Prevent Repair or Uninstall" how to or you can use the
"Install new version first and then uninstall old version" upgrade order.
Second scenario: XML config file
- User install products which includes an XML file containing some configuration data.
- Program runs and updates this XML file
- User updates to version 1.1. This will delete the XML file (during uninstall) and then recreate it (with default values).
This is the normal behavior when using the "Uninstall old version first and then install new version" upgrade option. As a workaround you can mark as
"Permanent" the component of your XML file.
All the best,
Daniel
FOLLOW US
Get the latest news in Application Packaging