Backup config file....possible ??
Backup config file....possible ??
Hi.
I need to have the msi backup (ie copy) an existing config file before installation. This will allow us to install a newer MSI and not loose the current configuration.
Example: Version 1.2 of software installed and working. Config file is stored in C:\Program Files\MySoftware\config.config
Version 1.3 of the msi needs to copy this config.config file first, before installing. This will allow us to install version 1.3 'on top' of version 1.2, thus updating everything. And since we would have a copy of the config.config file (say it was copied to C:\Temp); we can copy back this config file and away we go.
Is this possible ? It seems like when I lauch the 1.3 installer, it removes 1.2 FIRST. Thus using 'Run Program' to copy the config file doesn't work as the files from 1.2 are already removed at this point.
Thoughts ?
Thanks!
Patrick.
I need to have the msi backup (ie copy) an existing config file before installation. This will allow us to install a newer MSI and not loose the current configuration.
Example: Version 1.2 of software installed and working. Config file is stored in C:\Program Files\MySoftware\config.config
Version 1.3 of the msi needs to copy this config.config file first, before installing. This will allow us to install version 1.3 'on top' of version 1.2, thus updating everything. And since we would have a copy of the config.config file (say it was copied to C:\Temp); we can copy back this config file and away we go.
Is this possible ? It seems like when I lauch the 1.3 installer, it removes 1.2 FIRST. Thus using 'Run Program' to copy the config file doesn't work as the files from 1.2 are already removed at this point.
Thoughts ?
Thanks!
Patrick.
-
FrancescoT
- Site Admin
- Posts: 5361
- Joined: Sun Aug 22, 2010 4:28 am
Re: Backup config file....possible ??
Dear Patrick,
you should make a copy of that file, before uninstallation of your previous application starts.
Otherwise as you found, that file will be not availble for any subsequent calls.
The correct place in the script where you can make a backup copy of your file, should be in "Install Application Pre-Requisites" code region, within the NEEDUPGRADE conditional verification and before the effective previous version uninstall.
Example:
Pleace note that I used SUPPORTDIR as temporary folder file destination, if you do the same you can access your file later with your installation using $SUPPORTDIR$.
Also note that SUPPORDIR is available temporarily while the installation is executing and are cleaned up when the installer finishes execution.
So you don't need to delete the files once installation completed.
Hope this hlps you.
Regards
you should make a copy of that file, before uninstallation of your previous application starts.
Otherwise as you found, that file will be not availble for any subsequent calls.
The correct place in the script where you can make a backup copy of your file, should be in "Install Application Pre-Requisites" code region, within the NEEDUPGRADE conditional verification and before the effective previous version uninstall.
Example:
Code: Select all
if Variable NEEDSUPGRADE Equals TRUE
Copy Local Files C:\Program Files\MySoftware\config.config to $SUPPORTDIR$\config.config
Set Variable REMOVEOLD to
Set Variable ERROROLD to
Install/Remove MSI Package $PRODUCTCODE$[REMOVE=ALL] (get result into variable REMOVEOLD)
if Variable REMOVEOLD Equals ERROR
MessageBox: $TITLE$ Setup, Unable to uninstall old version of $TITLE$.
Please uninstall it yourself using Control Panel Add-Remove Programs before attempting to install this product.$NEWLINE$$NEWLINE$$ERROROLD$
Terminate Installation
end
if Variable REMOVEOLD Equals REBOOT
MessageBox: $TITLE$ Setup, Your computer needs to be restarted before $TITLE$ Setup can continue.
$NEWLINE$$NEWLINE$Please save your work in all running programs and click OK to restart your computer.
Setup will resume once your computer restarts.$NEWLINE$$NEWLINE$If you click CANCEL, setup will exit.
You will have to run setup again at a later time to install $TITLE$.
if Variable REBOOTNOW Equals OK
Reboot Computer and Resume Setup
else
Terminate Installation
end
end
Set Variable MAINTENANCE to FALSE
end
Also note that SUPPORDIR is available temporarily while the installation is executing and are cleaned up when the installer finishes execution.
So you don't need to delete the files once installation completed.
Hope this hlps you.
Regards
Francesco Toscano
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Re: Backup config file....possible ??
Thanks Francesco for the reply. Very helpful! I'm getting closer to getting it to work.
I updated the msi code to include the COPY FILE syntax, but it still didn't copy the file though.
How do I set the variable NEEDSUPGRADE to 'TRUE' ? I'm thinking that's why the copy file command did not run.
I haven't used a variable yet as per your suggestion just until I get it working. Then I'll update with variable as there will be more files to copy. I'm testing with just one file, trying to keep it simple.
Here is the snip of msi code:
[DEFINE REGION: Check Application Pre-Requisites]
Comment: Check setup pre-requisites
Set Variable PREREQ to FALSE
Set Variable PRELIST to
[compiler if Variable BUILDMODE not Equals PATCH]
if Variable NEEDSUPGRADE Equals TRUE
Set Variable PREREQ to TRUE
Set Variable PRELIST to $PRELIST$$NEWLINE$Previous Version Uninstallation
end
[compiler end]
<<Code Folding Region>>
[DEFINE REGION: Install Application Pre-Requisites]
Comment: Install setup pre-requisites
if Variable PREREQ not Equals FALSE
Comment: Display Dialog: prereq, wait for dialog to return (modal)
if Variable WIZARD Equals CANCEL
Terminate Installation
end
Comment: Display Dialog: progressprereq, use as progress dialog (non-modal)
[compiler if Variable BUILDMODE not Equals PATCH]
if Variable NEEDSUPGRADE Equals TRUE
Copy Local Files C:\Program Files (x86)\MySoftware\Data.xslt to C:\Temp\Data.xslt
Set Variable REMOVEOLD to
Set Variable ERROROLD to
Install/Remove MSI Package $PRODUCTCODE$[REMOVE=ALL] (get result into variable REMOVEOLD)
if Variable REMOVEOLD Equals ERROR
MessageBox: $TITLE$ Setup, Unable to uninstall old version of $TITLE$. Please uninstall it yourself using Control Panel Add-Remove Programs before attempting to install this product.$NEWLINE$$NEWLINE$$ERROROLD$
Terminate Installation
end
if Variable REMOVEOLD Equals REBOOT
MessageBox: $TITLE$ Setup, Your computer needs to be restarted before $TITLE$ Setup can continue.$NEWLINE$$NEWLINE$Please save your work in all running programs and click OK to restart your computer. Setup will resume once your computer restarts.$NEWLINE$$NEWLINE$If you click CANCEL, setup will exit. You will have to run setup again at a later time to install $TITLE$.
if Variable REBOOTNOW Equals OK
Reboot Computer and Resume Setup
else
Terminate Installation
end
end
Set Variable MAINTENANCE to FALSE
end
[compiler end]
Hide Dialog
end
<<Code Folding Region>>
<<Code Folding Region>>
I updated the msi code to include the COPY FILE syntax, but it still didn't copy the file though.
How do I set the variable NEEDSUPGRADE to 'TRUE' ? I'm thinking that's why the copy file command did not run.
I haven't used a variable yet as per your suggestion just until I get it working. Then I'll update with variable as there will be more files to copy. I'm testing with just one file, trying to keep it simple.
Here is the snip of msi code:
[DEFINE REGION: Check Application Pre-Requisites]
Comment: Check setup pre-requisites
Set Variable PREREQ to FALSE
Set Variable PRELIST to
[compiler if Variable BUILDMODE not Equals PATCH]
if Variable NEEDSUPGRADE Equals TRUE
Set Variable PREREQ to TRUE
Set Variable PRELIST to $PRELIST$$NEWLINE$Previous Version Uninstallation
end
[compiler end]
<<Code Folding Region>>
[DEFINE REGION: Install Application Pre-Requisites]
Comment: Install setup pre-requisites
if Variable PREREQ not Equals FALSE
Comment: Display Dialog: prereq, wait for dialog to return (modal)
if Variable WIZARD Equals CANCEL
Terminate Installation
end
Comment: Display Dialog: progressprereq, use as progress dialog (non-modal)
[compiler if Variable BUILDMODE not Equals PATCH]
if Variable NEEDSUPGRADE Equals TRUE
Copy Local Files C:\Program Files (x86)\MySoftware\Data.xslt to C:\Temp\Data.xslt
Set Variable REMOVEOLD to
Set Variable ERROROLD to
Install/Remove MSI Package $PRODUCTCODE$[REMOVE=ALL] (get result into variable REMOVEOLD)
if Variable REMOVEOLD Equals ERROR
MessageBox: $TITLE$ Setup, Unable to uninstall old version of $TITLE$. Please uninstall it yourself using Control Panel Add-Remove Programs before attempting to install this product.$NEWLINE$$NEWLINE$$ERROROLD$
Terminate Installation
end
if Variable REMOVEOLD Equals REBOOT
MessageBox: $TITLE$ Setup, Your computer needs to be restarted before $TITLE$ Setup can continue.$NEWLINE$$NEWLINE$Please save your work in all running programs and click OK to restart your computer. Setup will resume once your computer restarts.$NEWLINE$$NEWLINE$If you click CANCEL, setup will exit. You will have to run setup again at a later time to install $TITLE$.
if Variable REBOOTNOW Equals OK
Reboot Computer and Resume Setup
else
Terminate Installation
end
end
Set Variable MAINTENANCE to FALSE
end
[compiler end]
Hide Dialog
end
<<Code Folding Region>>
<<Code Folding Region>>
-
FrancescoT
- Site Admin
- Posts: 5361
- Joined: Sun Aug 22, 2010 4:28 am
Re: Backup config file....possible ??
Dear Patrick,
NEEDUPGRADE variable is automatically handled and initialized as TRUE when a previous version of the same application is found installed.
The code I suggest should be placed with 1.3 version of your project and will be executed only, if version 1.2 is installed on target system and before uninstallation of 1.2 version.
By your reply, I suspect exist some possible issues with the way you are using to manage your update ... am I wrong?
Regards
NEEDUPGRADE variable is automatically handled and initialized as TRUE when a previous version of the same application is found installed.
The code I suggest should be placed with 1.3 version of your project and will be executed only, if version 1.2 is installed on target system and before uninstallation of 1.2 version.
By your reply, I suspect exist some possible issues with the way you are using to manage your update ... am I wrong?
Regards
Francesco Toscano
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Re: Backup config file....possible ??
Hi.
What you mention sounds very simliar to what we require. That is, as an example, I have version 1.2 of our software installed.
I now have a new msi for version 1.3. This new msi can be installed on it's own, or 'on-top' of version 1.2.
That works just fine.
What I want to do is have version 1.3 make a copy of a config file before the msi installation removes the previous version.
If I can get that working, it will solve us a whole lot of other issues.
Patrick.
What you mention sounds very simliar to what we require. That is, as an example, I have version 1.2 of our software installed.
I now have a new msi for version 1.3. This new msi can be installed on it's own, or 'on-top' of version 1.2.
That works just fine.
What I want to do is have version 1.3 make a copy of a config file before the msi installation removes the previous version.
If I can get that working, it will solve us a whole lot of other issues.
Patrick.
-
FrancescoT
- Site Admin
- Posts: 5361
- Joined: Sun Aug 22, 2010 4:28 am
Re: Backup config file....possible ??
Dear Patrick.
Probably I've been misinterpreted.
Actually your 1.3 package removes the previous 1.2 version when executed?
If true, the NEEDUPGRADE variable must be TRUE when your 1.3 project script will executed ... otherwise your old package will be not removed.
Regards
Probably I've been misinterpreted.
Actually your 1.3 package removes the previous 1.2 version when executed?
If true, the NEEDUPGRADE variable must be TRUE when your 1.3 project script will executed ... otherwise your old package will be not removed.
Regards
Francesco Toscano
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Re: Backup config file....possible ??
Thanks for the quick response.
So we're back to the beginning. Everything is working fine, just not the code in the MSI to copy the config file to C:\Temp before version 1.3 removes version 1.2.
If I can get that part of the msi code (posted earlier) working, then this issue is closed.
Can you review the msi code I posted above and see if you can tell me why the Copy File isn't working ??
So we're back to the beginning. Everything is working fine, just not the code in the MSI to copy the config file to C:\Temp before version 1.3 removes version 1.2.
If I can get that part of the msi code (posted earlier) working, then this issue is closed.
Can you review the msi code I posted above and see if you can tell me why the Copy File isn't working ??
Re: Backup config file....possible ??
The Copy Files statement in my msi does contain spaces in the full path.
Could that cause an issue?
Example:
Copy Local Files C:\Program Files (x86)\C2ToolSuiteSR2\Our Software\ConfigFile.xslt C:\Temp\ConfigFile.xslt
Could that cause an issue?
Example:
Copy Local Files C:\Program Files (x86)\C2ToolSuiteSR2\Our Software\ConfigFile.xslt C:\Temp\ConfigFile.xslt
-
FrancescoT
- Site Admin
- Posts: 5361
- Joined: Sun Aug 22, 2010 4:28 am
Re: Backup config file....possible ??
Dear Patrick,
I missed an important step.
The command must be included inside a NATIVE ENGINE switch otherwise will not work ( ... because Copy/Move Local Files is a Windows Installer command).
Example:
The NATIVE ENGINE forces command to be executed immediatelly.
Regards
I missed an important step.
The command must be included inside a NATIVE ENGINE switch otherwise will not work ( ... because Copy/Move Local Files is a Windows Installer command).
Example:
Code: Select all
Set Variable NATIVE_ENGINE to TRUE
Copy Local Files C:\Program Files (x86)\MySoftware\Data.xslt to C:\Temp\Data.xslt
Set Variable NATIVE_ENGINE to FALSE
Regards
Francesco Toscano
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Re: Backup config file....possible ??
Thanks once again for the quick reponse. I added the NATIVE_ENGINE statement around the Copy Files but it still didn't work.
Here is the copy of the section of the msi code.....I'm wondering if I have the whole 'Copy Files' code in the wrong place ??
I appreciate your assistance on this, especially the quick response. I have a meeting today at 1:00EST to give an update on this project, so at least I seem closer to a solution.
Patrick.
[DEFINE REGION: Check Application Requirements]
<<Code Folding Region>>
[DEFINE REGION: Check/Install Application Pre-Requisites]
[DEFINE REGION: Check Application Pre-Requisites]
Comment: Check setup pre-requisites
Set Variable PREREQ to FALSE
Set Variable PRELIST to
[compiler if Variable BUILDMODE not Equals PATCH]
if Variable NEEDSUPGRADE Equals TRUE
Set Variable PREREQ to TRUE
Set Variable PRELIST to $PRELIST$$NEWLINE$Previous Version Uninstallation
end
[compiler end]
<<Code Folding Region>>
[DEFINE REGION: Install Application Pre-Requisites]
Comment: Install setup pre-requisites
if Variable PREREQ not Equals FALSE
Comment: Display Dialog: prereq, wait for dialog to return (modal)
if Variable WIZARD Equals CANCEL
Terminate Installation
end
Comment: Display Dialog: progressprereq, use as progress dialog (non-modal)
[compiler if Variable BUILDMODE not Equals PATCH]
if Variable NEEDSUPGRADE Equals TRUE
Set Variable NATIVE_ENGINE to TRUE
Copy Local Files C:\Program Files (x86)\C2ToolSuiteSR2\Our Software\ConfigFile.xslt to C:\Temp\ConfigFile.xslt
Set Variable NATIVE_ENGINE to FALSE Set Variable REMOVEOLD to
Set Variable ERROROLD to
Install/Remove MSI Package $PRODUCTCODE$[REMOVE=ALL] (get result into variable REMOVEOLD)
if Variable REMOVEOLD Equals ERROR
MessageBox: $TITLE$ Setup, Unable to uninstall old version of $TITLE$. Please uninstall it yourself using Control Panel Add-Remove Programs before attempting to install this product.$NEWLINE$$NEWLINE$$ERROROLD$
Terminate Installation
end
if Variable REMOVEOLD Equals REBOOT
MessageBox: $TITLE$ Setup, Your computer needs to be restarted before $TITLE$ Setup can continue.$NEWLINE$$NEWLINE$Please save your work in all running programs and click OK to restart your computer. Setup will resume once your computer restarts.$NEWLINE$$NEWLINE$If you click CANCEL, setup will exit. You will have to run setup again at a later time to install $TITLE$.
if Variable REBOOTNOW Equals OK
Reboot Computer and Resume Setup
else
Terminate Installation
end
end
Set Variable MAINTENANCE to FALSE
end
[compiler end]
Hide Dialog
end
<<Code Folding Region>>
<<Code Folding Region>>
Here is the copy of the section of the msi code.....I'm wondering if I have the whole 'Copy Files' code in the wrong place ??
I appreciate your assistance on this, especially the quick response. I have a meeting today at 1:00EST to give an update on this project, so at least I seem closer to a solution.
Patrick.
[DEFINE REGION: Check Application Requirements]
<<Code Folding Region>>
[DEFINE REGION: Check/Install Application Pre-Requisites]
[DEFINE REGION: Check Application Pre-Requisites]
Comment: Check setup pre-requisites
Set Variable PREREQ to FALSE
Set Variable PRELIST to
[compiler if Variable BUILDMODE not Equals PATCH]
if Variable NEEDSUPGRADE Equals TRUE
Set Variable PREREQ to TRUE
Set Variable PRELIST to $PRELIST$$NEWLINE$Previous Version Uninstallation
end
[compiler end]
<<Code Folding Region>>
[DEFINE REGION: Install Application Pre-Requisites]
Comment: Install setup pre-requisites
if Variable PREREQ not Equals FALSE
Comment: Display Dialog: prereq, wait for dialog to return (modal)
if Variable WIZARD Equals CANCEL
Terminate Installation
end
Comment: Display Dialog: progressprereq, use as progress dialog (non-modal)
[compiler if Variable BUILDMODE not Equals PATCH]
if Variable NEEDSUPGRADE Equals TRUE
Set Variable NATIVE_ENGINE to TRUE
Copy Local Files C:\Program Files (x86)\C2ToolSuiteSR2\Our Software\ConfigFile.xslt to C:\Temp\ConfigFile.xslt
Set Variable NATIVE_ENGINE to FALSE Set Variable REMOVEOLD to
Set Variable ERROROLD to
Install/Remove MSI Package $PRODUCTCODE$[REMOVE=ALL] (get result into variable REMOVEOLD)
if Variable REMOVEOLD Equals ERROR
MessageBox: $TITLE$ Setup, Unable to uninstall old version of $TITLE$. Please uninstall it yourself using Control Panel Add-Remove Programs before attempting to install this product.$NEWLINE$$NEWLINE$$ERROROLD$
Terminate Installation
end
if Variable REMOVEOLD Equals REBOOT
MessageBox: $TITLE$ Setup, Your computer needs to be restarted before $TITLE$ Setup can continue.$NEWLINE$$NEWLINE$Please save your work in all running programs and click OK to restart your computer. Setup will resume once your computer restarts.$NEWLINE$$NEWLINE$If you click CANCEL, setup will exit. You will have to run setup again at a later time to install $TITLE$.
if Variable REBOOTNOW Equals OK
Reboot Computer and Resume Setup
else
Terminate Installation
end
end
Set Variable MAINTENANCE to FALSE
end
[compiler end]
Hide Dialog
end
<<Code Folding Region>>
<<Code Folding Region>>
-
FrancescoT
- Site Admin
- Posts: 5361
- Joined: Sun Aug 22, 2010 4:28 am
Re: Backup config file....possible ??
Dear Patrick,
I'm sorry but just observing your code it is not possible to find out what happen on your side.
Which is your InstallAware version?
Are you sure the file exist?
Are sure you are pointing the a correct path?
It is strongly discouraged to enter path directly with the command, you should use variables for that.
This will assure you to avoid path errors as Program Files or Program Files (x86) caused by platform architecture differences.
If you still have problem, try to replicate your issue with a sample project and post it, along with all files you used in compressed form (In your case, the first setup package it is also required).
Regards
I'm sorry but just observing your code it is not possible to find out what happen on your side.
Which is your InstallAware version?
Are you sure the file exist?
Are sure you are pointing the a correct path?
It is strongly discouraged to enter path directly with the command, you should use variables for that.
This will assure you to avoid path errors as Program Files or Program Files (x86) caused by platform architecture differences.
If you still have problem, try to replicate your issue with a sample project and post it, along with all files you used in compressed form (In your case, the first setup package it is also required).
Regards
Francesco Toscano
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Re: Backup config file....possible ??
HI.
I'm using InstallAware Studio 2012.
The file does exist. I keep an eye on C:\Temp during the install of the new version and the file doesn't appear to ever be copied there.
I used direct paths for now just for ease of debugging. Once I get it working, I'll update the msi code to use variables.
I'll see what I can do to create a 'dummy' software package.
I'm using InstallAware Studio 2012.
The file does exist. I keep an eye on C:\Temp during the install of the new version and the file doesn't appear to ever be copied there.
I used direct paths for now just for ease of debugging. Once I get it working, I'll update the msi code to use variables.
I'll see what I can do to create a 'dummy' software package.

