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

Carlos Sosa carlos.sosa.us at outlook.com
Thu Oct 20 11:06:01 PDT 2016


Thank you for your suggestions, I will test them asap, and report back to
you.
I'm fighting some fires at the moment (you know how it is)

Best.


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

I would start by removing the custom action and examining detailed log from
doing an upgrade - I find it helps trace behavior

The command would be something like 'msiexec.exe /I yournewmsi.msi /l*V
c:\temp\YourLog.log"
You appear to be putting BE.accdb in the INSTALLFOLDER. If you run the app
after installation and do something that modifies the DB it should get left
behind on uninstall.  If the db is not modified it should get removed and
replaced on upgrade. 

and
<ComponentRef Id="CMP_Aditional_DIR"/>  -- Is an orphan - the component name
itself has 2 dd's in the name And Bob Arnson's Blog
(http://www.joyofsetup.com )  has 'Bad Practices" and "Best Practices" tags
that are worth reading.

These two posts helped me  0
Be Generous with Upgrade Codes
Paying-For-Upgrades


-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of
Phill Hogland
Sent: Thursday, October 20, 2016 8:13 AM
To: WiX Toolset Users Mailing List
Subject: Re: [wix-users] Custom action to backup folder before install

>>>As I understand it, with your Product Id="*" you will always be doing a
major upgrade

Just to clarify, there are other factors that need to be considered.  For
the MSI the version also needs to change in the first three sections.  (A
Bundle will generally mimic the MajorUpgrade behavior when any part of the
version is changed), and in both cases the UpgradeCode is not changed.

________________________________
From: wix-users <wix-users-bounces at lists.wixtoolset.org> on behalf of Tyler
Gustafson <tgustafson at solacom.com>
Sent: Thursday, October 20, 2016 9:56:20 AM
To: WiX Toolset Users Mailing List
Subject: Re: [wix-users] Custom action to backup folder before install

As I understand it, with your Product Id="*" you will always be doing a
major upgrade
https://msdn.microsoft.com/en-us/library/aa369786(v=vs.85).aspx which is
probably fine since you want to be able to install the entire application if
it's not there already. Minor upgrades are better packaged as patches which
you might end up looking into down the road if you need a smaller
deliverable or the ability to roll back upgrades but a patch can't handle
installing the application from scratch.

Your components look fine to me with one "thing" per component so you
shouldn't be breaking component rules but here are some of the consequences
https://msdn.microsoft.com/en-us/library/aa372795.aspx

Try making your MajorUpgrade element look like this instead and see if the
database gets left around.

    <MajorUpgrade AllowDowngrades="no"
                  AllowSameVersionUpgrades="no"
                  DowngradeErrorMessage="A newer version of [ProductName] is
already installed."
                  Schedule="afterInstallExecute"/>

These are websites I made note of when I was researching this stuff in no
particular order. If you curious they might be of help.
 
https://blogs.msdn.microsoft.com/astebner/2007/02/09/assemblies-may-be-missi
ng-from-the-gac-or-winsxs-cache-after-an-msi-major-upgrade/
 
https://blogs.msdn.microsoft.com/heaths/2010/04/09/major-upgrades-with-share
d-components/
 
https://msdn.microsoft.com/en-us/library/windows/desktop/aa371197(v=vs.85).a
spx
 
http://wixtoolset.org/documentation/manual/v3/xsd/wix/majorupgrade.html
        http://www.joyofsetup.com/2008/12/30/paying-for-upgrades/


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

This is how the installer looks like now:
I don't think I understand the difference between Mayor/Minor upgrade (in
terms of deployment) other than versioning number (please point me to the
right direction for more info) (I need to be able to install the entire
application if it's not already
installed)
Do I need to change any of the GUIs when a new version is created?


<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">

  <?define ProductName = "MyProduct" ?>
  <?define ProductManufacturer = "manufacturer" ?>
  <?define ShortcutDescription = "Description" ?>
  <?define UpgradeCode = "6d21517b-XXXX-450a-XXX-fdb0daXXXX16" ?>
  <!--<?define
ProductVersion="$(fileVersion.ProductVersion($(var.ProductFeature.TargetPath
)))" ?>-->

  <Product Id="*"
           Name="$(var.ProductName)"
           Language="1033"
           Version="9.9.9.9"
           Manufacturer="$(var.ProductManufacturer)"
           UpgradeCode="$(var.UpgradeCode)">
    <Package InstallerVersion="200" Compressed="yes"
InstallScope="perMachine" InstallPrivileges="elevated" />
    <MajorUpgrade AllowDowngrades="no"
                  AllowSameVersionUpgrades="no"
                  DowngradeErrorMessage="A newer version of [ProductName] is
already installed." />
    <MediaTemplate EmbedCab="yes"/>
    <Icon Id="icon.ico" SourceFile="..\..\Lib\MyIcon.ico"/>
    <Property Id="ARPPRODUCTICON" Value="icon.ico" />

    <UI>
      <UIRef Id="WixUI_Minimal" />
    </UI>

    <Feature Id="ProductFeature" Title="TestInstaller" Level="1">
      <ComponentGroupRef Id="CMP_ProductComponents" />
      <ComponentRef Id="CMP_StartMenuShortcut" />
      <ComponentRef Id="CMP_DesktopShortcut" />
      <ComponentRef Id="CMP_Aditional_DIR"/>
    </Feature>

  </Product>



***********************************************************
DIRECTORIES
***********************************************************

<Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="DesktopFolder"  SourceName="Desktop"/>
      <Directory Id="MyProduct">
        <Directory Id="INSTALLFOLDER" Name="MyProduct">
          <Directory Id="IMPORT_EXPORT_DIR" Name="IMPORT_EXPORT"/>
        </Directory>
      </Directory>
      <Directory Id ="ProgramMenuFolder">
        <Directory Id="StartMenu" Name="$(var.ProductName)"/>
      </Directory>
    </Directory>

    <DirectoryRef Id="IMPORT_EXPORT_DIR">
      <Component Id = "CMP_Additional_DIR"
                 Guid = "959533F3-XXXX-4BB4-XXXX-82BEXXXX1DDE"
                 KeyPath = "yes">
        <CreateFolder/>
      </Component>
    </DirectoryRef>

  </Fragment>




***********************************************************
COMPONENT IN QUESTION
***********************************************************

<Fragment>
    <ComponentGroup Id="CMP_ProductComponents" Directory="INSTALLFOLDER">
      <Component Id ="Application"
                 Guid="D1A0CFA1-XXXX-4BAA-XXXX-81AXXXX67E8E">
        <File Id ="FILE_My_Application"
              Source ="..\..\Lib\FE.accdr"
              KeyPath ="yes">
          <util:PermissionEx User ="Users"
                           GenericAll="yes"/>
        </File>
      </Component>
      <Component Id ="BackEnd"
                 Guid="4C2F753B-XXXX-4075-XXXX-E6AC6XXXXACA"
                 Permanent="yes"
                 NeverOverwrite="yes">
        <File Id ="FILE_BackEnd"
              Source ="..\..\Lib\BE.accdb"
              KeyPath ="yes">
          <util:PermissionEx User ="Users"
                             GenericAll="yes"/>
        </File>
      </Component>
      <Component Id ="icon"
             Guid="E1E94A0A-XXXX-4DB7-XXXX-CF96XXXX8CFB">
        <File Id ="icon"
              Source ="..\..\Lib\MyIcon.ico"
              KeyPath ="yes" />
      </Component>
    </ComponentGroup>
  </Fragment>








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

What does your 'MajorUpgrade' element say?
And on a really off-chance - the "CreateFolder" element doesn't say "Remove"
does it? In normal behavior a folder is deleted if it's empty and left
behind if there is content in the folder.  So - I expect your DB to be
untouched on upgrade and the folder not being deleted. - unless you force
the folder deletion in the CreateFolder element.



-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of
Carlos Sosa
Sent: Wednesday, October 19, 2016 1: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/

____________________________________________________________________
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



____________________________________________________________________
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/



More information about the wix-users mailing list