[wix-users] Custom action to backup folder before install

Tyler Gustafson tgustafson at solacom.com
Wed Oct 19 14:09:32 PDT 2016


Are you doing a Major upgrade? That is different than a minor upgrade because behind the scenes it uninstalls and then reinstalls everything. You shouldn't need permanent unless that's true and it would explain why your unversioned files would be erased even if they were locally modified.

As Blaine mentioned, check out the MajorUpgrade element where you can set a Schedule for the RemoveExistingProducts standard action. I have mine defined like this:
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." Schedule="afterInstallExecute" />

When set to afterInstallExecute, a Major upgrade will install things or bump their reference counts and then uninstall what is no longer needed which effectively keeps your files around through a Major upgrade. You need to be careful with this setting because it can cause problems if you break the component rules.


-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of Carlos Sosa
Sent: October-19-16 4:43 PM
To: 'WiX Toolset Users Mailing List'
Subject: Re: [wix-users] Custom action to backup folder before install

Thnx for the input, but I still can't get it to work.

The db still gets deleted/replaced everytime.
 
Now there are 2 attributes that have to be set if you don't want the file to be overwritten Permanent and NeverOverwrite, if these are set to yes, the file will not be replaced.
However....

On version 1 I did not set those options (and the app has already been
deployed)  so when I run the update v2, it gets overwritten (if I run v3 it will stay safe)

<Component Id ="BackEnd"
                 Guid="4C2F753B-XXXX-4075-XXXX-E6AC646FBACA"
                 Permanent="yes"
                 NeverOverwrite="yes">
        <File Id ="BackEnd"
              Source ="..\..\Lib\BE.accdb"
              KeyPath ="yes">
          <util:PermissionEx User ="Users"
                             GenericAll="yes"/>
        </File>
      </Component>

I looked at the upgradecode element but there is not much info:
http://wixtoolset.org/documentation/manual/v3/xsd/wix/upgrade.html
I also try some settings under the scheduling attribute http://wixtoolset.org/documentation/manual/v3/xsd/wix/majorupgrade.html but no luck.

I may be missing something.




-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of Phil Wilson
Sent: Wednesday, October 19, 2016 12:37 PM
To: 'WiX Toolset Users Mailing List' <wix-users at lists.wixtoolset.org>
Subject: Re: [wix-users] Custom action to backup folder before install

Exactly, yes. The Windows Installer overwrite rules don't replace files that have been altered since the install:

https://msdn.microsoft.com/en-us/library/windows/desktop/aa370531(v=vs.85).a
spx

And a similar case with hashing.

Phil  

-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of Wheeler, Blaine (DSHS/DCS)
Sent: Tuesday, October 18, 2016 3:08 PM
To: 'WiX Toolset Users Mailing List'
Subject: Re: [wix-users] Custom action to backup folder before install

The db wouldn't be overwritten by the installer because it changed from the original installation if you are doing an upgrade.  Check out the UpgradeCode and MajorUpgrade element

-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of Carlos Sosa
Sent: Tuesday, October 18, 2016 12:51 PM
To: 'WiX Toolset Users Mailing List'
Subject: Re: [wix-users] Custom action to backup folder before install

Because the INSTALLFOLDER contains a database that has been modified and I need to keep.
I was able to do this using a .bat file

Thank you.


-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of Wheeler, Blaine (DSHS/DCS)
Sent: Tuesday, October 18, 2016 8:56 AM
To: 'WiX Toolset Users Mailing List' <wix-users at lists.wixtoolset.org>
Subject: Re: [wix-users] Custom action to backup folder before install

Why?  The installer service creates a restore point and also makes a roll-back source so it can recover from a failed or cancelled installation.
At the end of the successful installation the roll-back is deleted.

-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of Carlos Sosa
Sent: Monday, October 17, 2016 2:36 PM
To: wix-users at lists.wixtoolset.org
Subject: [wix-users] Custom action to backup folder before install


Hello I need to back up the INSTALLFOLDER before upgrade/install.
I'm using a custom action as follows:

<InstallExecuteSequence>
    <Custom Action="BackupDB" After="InstallInitialize" /> </InstallExecuteSequence>


But I cannot seem to be able to define the custom action appropriately

<Fragment>

   <CustomAction Id='BackupDB'
                 BinaryKey='FooBinary'
                 DllEntry='FooEntryPoint'
                 Execute='immediate'
                 Return='check'>


    <CopyFile Id="SomeId" SourceProperty="SOURCEDIRECTORY"
      DestinationDirectory="INSTALLFOLDER" SourceName="*" />


   </CustomAction>



  </Fragment>


Using Visual Studio 2015 and Wix 3.1
Any help is appreciated.
Regards

____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/

____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/

____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/

____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/






____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/

____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/
--
Scanned by Total Defense Email Cloud Security http://cloud.totaldefense.com




More information about the wix-users mailing list