[wix-users] Unable to Uninstall Patch

Ven H venh.123 at gmail.com
Mon Jun 4 09:39:09 PDT 2018


Thanks David. For the rollback and uninstall scenarios, I have already
informed them that there have to be separate scripts to handle those.



On Mon, Jun 4, 2018 at 10:01 PM, David Watson <dwatson at sdl.com> wrote:

> Hi,
>
> There are two systems going on here, windows installer patching and the
> wix sql custom actions.
>
> Your sql items are in a single windows installer component which contains
> no file or registry items so the keypath is probably the folder above, as
> such you have no component level control over whether the component will be
> updated (in a patch or otherwise) as that would usually be done by file
> version.
>
> The SQL custom actions are therefore independent and being run every time
> and act only on what you are telling them to do. So the embedded sql script
> will run when the flags tell it to run as you have found.
>
> You are dealing with a can of worms here when doing database deployments
> with MSI, you need to think about rollback on error and uninstall.
>
> Do you want the database to revert to its previous state when you
> uninstall the patch? How will that happen, you will need an uninstall
> script.
>
> Are you really sure you want to do this?
>
> Also its possible that the SQL extension is adding something to the MSI to
> make the patch uninstallable.
>
> Open the original MSI in orca or Insted and apply the patch then check for
> issues in the noted tables.
>
> Dave
>
> *www.sdl.com* <http://www.sdl.com/>
> SDL PLC confidential, all rights reserved. If you are not the intended
> recipient of this mail SDL requests and requires that you delete it without
> acting upon or copying any of its contents, and we further request that you
> advise us.​
> ​SDL PLC is a public limited company registered in England and Wales.
> Registered number: 02675207.
> Registered address: SDL PLC, New Globe House, Vanwall Business
> Park, Vanwall Road, Maidenhead, SL6 4UB, U.K.
> -----Original Message-----
> From: wix-users <wix-users-bounces at lists.wixtoolset.org> On Behalf Of Ven
> H via wix-users
> Sent: 04 June 2018 16:12
> To: Edwin Castro <egcastr at gmail.com>
> Cc: Ven H <venh.123 at gmail.com>; WiX Toolset Users Mailing List <
> wix-users at lists.wixtoolset.org>
> Subject: Re: [wix-users] Unable to Uninstall Patch
>
> No Edwin. What I mean is that, if I add this attribute, then only the
> SqlScript element with the modified sql statement runs during the Patch
> installation.
>
> In case if I add a separate component, then after the Patch installation,
> the Uninstall option disappears. This is a different issue. So, there are
> two different issues.
>
> Regards,
> Venkatesh
>
> On Mon, Jun 4, 2018 at 7:33 PM, Edwin Castro <egcastr at gmail.com> wrote:
>
> > Are you saying that with ExecuteOnReinstall="yes" you see the
> > uninstall option for the patch and without it you don't?
> >
> > --
> > Edwin G. Castro
> >
> >
> >
> >
> > On Mon, Jun 4, 2018, 03:06 Ven H <venh.123 at gmail.com> wrote:
> >
> >> One more quick point. In the Product.wxs above, if I added
> >> ExecuteOnReinstall="yes" also in addition to ExecuteOnInstall=yes,
> >> then it works during Patch also. But if I only have
> >> ExecuteOnInstall=yes, it doesn't work during Patch. Please test it
> >> without ExecuteOnReinstall=yes attribute. So, is this the solution? Is
> it correct? Please help.
> >>
> >> Regards,
> >> Venkatesh
> >>
> >> On Mon, Jun 4, 2018 at 3:18 PM, Ven H <venh.123 at gmail.com> wrote:
> >>
> >>> Thank you Edwin. Below is the complete detail.
> >>>
> >>> Basically, I have a Visual Studio MSI project with a Sample.txt and
> >>> CREATE_TABLE.sql files at the root level. The Sample.txt has a text
> >>> "This is version 1.0.0." and nothing else and the CREATE_TABLE.sql
> >>> has an SQL statement to create a table as below.
> >>>
> >>> use TestDB
> >>> go
> >>>
> >>> if not exists( select 1 from information_schema.tables where
> >>> table_name = 'EMPLOYEES' ) begin create table dbo.EMPLOYEES ( EMP_ID
> >>> INT NOT NULL, EMP_NAME NVARCHAR(100) NOT NULL
> >>> )
> >>> end
> >>> go
> >>>
> >>> Following is the markup of Product.wxs
> >>>
> >>> *Product.wxs*
>
> >>>
> >>> <?xml version="1.0" encoding="UTF-8"?> <Wix
> >>> xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="
> >>> http://schemas.microsoft.com/wix/UtilExtension" xmlns:sql="
> >>> http://schemas.microsoft.com/wix/SqlExtension">
> >>> <Product Id="F3374DBE-A524-44FA-9052-4C6F88249F10"
> Name="DBPatchSample"
> >>> Language="1033" Version="1.0.0.0" Manufacturer="DB_Patch_Sample"
> >>> UpgradeCode="42855AC1-CE52-4366-B419-83503155C417">
> >>> <Package InstallerVersion="200" Compressed="yes"
> >>> InstallScope="perMachine" />
> >>>
> >>> <MajorUpgrade DowngradeErrorMessage="A newer version of
> >>> [ProductName] is already installed." /> <MediaTemplate
> >>> EmbedCab="yes" />
> >>>
> >>> <util:User Id="SQLUser" Name="[SQLUSER]"
> >>> Password="[SQLPASSWORD]" />
> >>>
> >>> <Binary Id="binCreateTbl" SourceFile="CREATE_TABLE.sql" />
> >>>
> >>> <Property Id="MSIUSEREALADMINDETECTION" Value="1" />
> >>> <Property Id="MSIFASTINSTALL" Value="1"/>
> >>> <Property Id="MsiLogging" Value="v" />
> >>> <Property Id="MSIENFORCEUPGRADECOMPONENTRULES" Value="1" />
> >>> <Property Id="SQLSERVER" Value="ServerName"/>
> >>> <Property Id="SQLINSTANCE" Value="InstanceName"/>
> >>> <Property Id="SQLDB" Value="TestDB"/>
> >>> <Property Id="SQLUSER" Value="sa"/>
> >>> <Property Id="SQLPASSWORD" Value="Sa_Pwd"/>
> >>>
> >>> <Feature Id="ProductFeature" Title="DBPatchSample" Level="1">
> >>> <ComponentGroupRef Id="DbCG" /> </Feature>
> >>> <UI Id="MyWixUI_Mondo">
> >>> <UIRef Id="WixUI_Mondo" />
> >>> </UI>
> >>> <UIRef Id="WixUI_ErrorProgressText" /> </Product>
> >>>
> >>> <Fragment>
> >>> <Directory Id="TARGETDIR" Name="SourceDir"> <Directory
> >>> Id="ProgramFilesFolder"> <Directory Id="INSTALLFOLDER"
> >>> Name="DBPatchSample" /> </Directory> </Directory> </Fragment>
> >>>
> >>> <Fragment>
> >>> <ComponentGroup Id="DbCG">
> >>> <Component Id="fileComp" Guid="92526A26-9404-449B-9EAA-7FC175F2EBE4"
> >>> Directory="INSTALLFOLDER" KeyPath="yes">
> >>> <File Id="sampleTxt" Name="Sample.txt" Source="Sample.txt" />
> >>> </Component>
> >>> <Component Id="dbComp1" Guid="B4E70B72-DB9C-4215-B4DF-022B56A26C01"
> >>> Directory="INSTALLFOLDER" KeyPath="yes">
> >>> <sql:SqlDatabase Id="msiTestDB1" Database="[SQLDB]"
> >>> Server="[SQLSERVER]" Instance="[SQLINSTANCE]" CreateOnInstall="yes"
> >>> User="SQLUser" />
> >>> <sql:SqlScript BinaryKey="binCreateTbl" Id="script_CreateTbl"
> >>> ExecuteOnInstall="yes" ExecuteOnReinstall="yes" ContinueOnError="no"
> >>> SqlDb="msiTestDB1" Sequence="1" />
> >>> </Component>
> >>> </ComponentGroup>
> >>> </Fragment>
> >>> </Wix>
> >>>
> >>> With this, I created an MSI and installed it. It does create the
> >>> table with the two columns in it. In the C:\Program
> >>> Files(x86)\DBPatchSample folder, I could find only the Sample.txt file
> and not the CREATE_TABLE.sql.
> >>> This is probably because the sql file is a binary and has been set
> >>> to execute on install.
> >>>
> >>> In my bin/debug folder, I created 3 folders namely 1.0.0, 1.0.1 and
> >>> Patch. Within 1.0.0 folder and 1.0.1 folders, I created a folder
> >>> called "admin". In the Patch folder, I copied my Patch.wxs, whose
> >>> markup is as given below. Then I moved the first MSI to 1.0.0 folder.
> >>>
> >>> *Patch.wxs *
> >>>
> >>> <?xml version="1.0" encoding="UTF-8"?><Wix xmlns="http://schemas.
> >>> microsoft.com/wix/2006/wi">
> >>> <PatchCreation WholeFilesOnly="yes" CleanWorkingFolder="yes"
> >>> OutputPath="patch.pcp" Id="224C316C-5894-4771-BABF-21A3AC1F75FF">
> >>> <PatchInformation Description="Patch Info Description"
> >>> Comments="Patch Info Comments" Manufacturer="DB_Patch_Sample"
> >>> Languages="1033" ShortNames="no" Compressed="yes"/>
> >>> <PatchMetadata Description="Patch Metadata Description"
> >>> ManufacturerName="DB_Patch_Sample" MoreInfoURL="URL_Here"
> >>> AllowRemoval="yes" Classification="Update" DisplayName="DB Patch
> >>> Sample Patch" TargetProductName="DBPatchSample"/>
> >>> <Family MediaSrcProp="Sample" SequenceStart="5000" DiskId="5000"
> >>> Name="Sample">
> >>> <UpgradeImage SourceFile="D:\MyProjects\WIX\
> >>> DBPatchSample\bin\Debug\1.0.1\admin\DBPatchSample.msi"
> >>> Id="SampleUpgrade">
> >>> <TargetImage Order="2" IgnoreMissingFiles="no"
> >>> SourceFile="D:\MyProjects\WIX\DBPatchSample\bin\Debug\1.0.0\
> admin\DBPatchSample.msi"
> >>> Id="SampleTarget"/>
> >>> </UpgradeImage>
> >>> </Family>
> >>> <PatchSequence Supersede="yes" PatchFamily="SamplePatchFamily"
> >>> Sequence="1.0.0.0"/>
> >>> </PatchCreation>
> >>> </Wix>
> >>>
> >>>
> >>> Now, to create the 1.0.1, I only updated the CREATE_TABLE.sql as below.
> >>>
> >>> use TestDB
> >>> go
> >>>
> >>> ALTER TABLE dbo.EMPLOYEES
> >>> ADD LAST_NAME nvarchar(100)
> >>>
> >>> This is the only change. I also update the Version in Product.wxs to
> >>> 1.0.1. That's it. I rebuilt this MSI and moved it inside 1.0.1 folder.
> >>>
> >>> Then I ran the following commands to create the Patch in a command
> >>> prompt after changing to the appropriate directory (I am using PCP
> >>> approach for Patch).
> >>>
> >>> msiexec.exe /a 1.0.0\DBPatchSample.msi /qb
> >>> TARGETDIR=D:\MyProjects\WIX\ DBPatchSample\bin\Debug\1.0.0\admin
> >>>
> >>> msiexec.exe /a 1.0.1\DBPatchSample.msi /qb
> >>> TARGETDIR=D:\MyProjects\WIX\ DBPatchSample\bin\Debug\1.0.1\admin
> >>>
> >>> candle.exe Patch\patch.wxs
> >>>
> >>> light.exe patch.wixobj -out patch\patch.pcp
> >>>
> >>> msimsp.exe -s patch\patch.pcp -p patch\patch.msp -l patch.log
> >>>
> >>> When I checked the Patch.log also, it is only try to compare the
> >>> byte content of Sample.txt and not CREATE_TABLE.sql, even though
> >>> only the sql file content has changed.
> >>>
> >>> After I install the patch, I can see the Update installed in ARP
> >>> Installed Updates, but the DB changes are not reflected. There are
> >>> no errors in the logs also. If I add the changes in a separate sql
> >>> file within a new component, then the DB changes are reflected, but
> >>> the Uninstall option in the ARP disappears. I am very confused. In
> >>> case of SqlScript element, the sql file is actually not present
> >>> physically in the machine and it gets executed during install. Hence
> >>> I am not sure, if it is not able to capture it as a change. I would
> >>> humbly request you to try out the above sample and check if it works
> >>> or not and also please let me know what is missing / incorrect above.
> Please help.
> >>>
> >>>
> >>> Regards,
> >>> Venkatesh
> >>>
> >>> On Sat, Jun 2, 2018 at 12:53 AM, Edwin Castro <egcastr at gmail.com>
> wrote:
> >>>
> >>>> Use something like Orca or InstEdit to compare your old.msi and
> >>>> your new.msi. InstEdit has a "Compare Against..." menu item under
> >>>> the "Transform" menu which can help you see the differences easier.
> >>>> Look for new rows in the tables listed on the page linked by Rob. I
> >>>> would expect you're going to find new rows in one or more of those
> tables.
> >>>>
> >>>> --
> >>>> Edwin G. Castro
> >>>>
> >>>>
> >>>> On Fri, Jun 1, 2018 at 11:11 AM, Ven H via wix-users <
> >>>> wix-users at lists.wixtoolset.org> wrote:
> >>>>
> >>>>> Thank you very much, Rob. In my case, I have the MsiPatchMetadata
> >>>>> table in the Patch.msp, when opened using Orca and the other
> >>>>> conditions are also fine.
> >>>>>
> >>>>> So, it looks like I am not getting how Patch works with SqlScript
> >>>>> elements.
> >>>>> It will be great, if someone can please explain how to create
> >>>>> Patch for SqlScript for DB. I couldn't find much info on that.
> >>>>>
> >>>>> Regards,
> >>>>> Venkatesh
> >>>>>
> >>>>> On Fri, Jun 1, 2018 at 9:57 PM, Rob Mensching via wix-users <
> >>>>> wix-users at lists.wixtoolset.org> wrote:
> >>>>>
> >>>>> > https://msdn.microsoft.com/en-us/library/windows/desktop/
> >>>>> > aa372102(v=vs.85).aspx
> >>>>> >
> >>>>> > _____________________________________________________________
> >>>>> > Short replies here. Complete answers over there:
> >>>>> > http://www.firegiant.com/
> >>>>> >
> >>>>> > -----Original Message-----
> >>>>> > From: wix-users <wix-users-bounces at lists.wixtoolset.org> On
> >>>>> > Behalf
> >>>>> Of Ven
> >>>>> > H via wix-users
> >>>>> > Sent: Friday, June 1, 2018 6:22 AM
> >>>>> > To: WiX Toolset Users Mailing List
> >>>>> > <wix-users at lists.wixtoolset.org>
> >>>>> > Cc: Ven H <venh.123 at gmail.com>
> >>>>> > Subject: Re: [wix-users] Unable to Uninstall Patch
> >>>>> >
> >>>>> > So, I think I need to explain a little more. I have an MSI which
> >>>>> > has
> >>>>> a
> >>>>> > text file in a component and SqlScript element in a different
> >>>>> component. In
> >>>>> > this SqlScript element, I am creating a table with 2 columns. I
> >>>>> install
> >>>>> > this MSI and the text file is created and the SqlScript is
> >>>>> > executed
> >>>>> to
> >>>>> > create the table with 2 columns in the Database.
> >>>>> >
> >>>>> > Now, I am adding another SqlScript element (here I am creating
> >>>>> another
> >>>>> > table with 2 columns) in a new component and also making a
> >>>>> > slight
> >>>>> change in
> >>>>> > the sample text file. With this, I create the patch using the
> >>>>> > Patch Creation Properties approach. The patch gets created
> >>>>> > successfully
> >>>>> and also
> >>>>> > gets installed. After installation, I can see the new table
> >>>>> > created
> >>>>> and the
> >>>>> > sample text file modified. But now, when I go to Installed
> >>>>> > Updates,
> >>>>> the
> >>>>> > Uninstall option is missing for this patch, even though, I
> >>>>> > specify AllowRemoval=yes.
> >>>>> >
> >>>>> > Now, instead of adding another SqlScript element, if I just
> >>>>> > modify
> >>>>> the
> >>>>> > existing SqlScript (I mean the binary sql file content), by
> >>>>> > altering
> >>>>> the
> >>>>> > table or adding another create table statement inside it, the
> >>>>> > patch
> >>>>> doesn't
> >>>>> > seem to apply these changes, although, now the Uninstall option
> >>>>> > is available and I can uninstall the patch. I am not able to
> >>>>> > understand
> >>>>> this.
> >>>>> >
> >>>>> > So, I have a couple of questions.
> >>>>> >
> >>>>> > 1. Why does the Uninstall option disappear for a Patch when a
> >>>>> > new Component is added? I am actually not removing a component,
> >>>>> > but
> >>>>> adding one.
> >>>>> > So, I am not sure, if I am breaking the Component rules.
> >>>>> >
> >>>>> > 2. How do we Patch SqlScript elements? It is possible that,
> >>>>> > after installation, the developer will make a small change in
> >>>>> > one of the
> >>>>> sql
> >>>>> > files. For this small change, I don't want to do a full upgrade.
> >>>>> >
> >>>>> > Please help.
> >>>>> >
> >>>>> >
> >>>>> > Regards,
> >>>>> > Venkatesh
> >>>>> >
> >>>>> > On Fri, Jun 1, 2018 at 4:28 PM, Ven H <venh.123 at gmail.com> wrote:
> >>>>> >
> >>>>> > > I am building a Patch using the Patch Creation Properties. I
> >>>>> > > have a Patch.wxs in which there is a PatchMetadata element
> >>>>> > > with AllowRemoval="yes". Even then the Patch doesn't give me
> >>>>> > > the option
> >>>>> to
> >>>>> > > uninstall in the Installed Updates. Can any one please help?
> >>>>> > >
> >>>>> > > FYI, please find the Patch.wxs mark up below.
> >>>>> > >
> >>>>> > > <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
> >>>>> > > <PatchCreation WholeFilesOnly="yes" CleanWorkingFolder="yes"
> >>>>> > > OutputPath="patch.pcp" Id="224C316C-5894-4771-BABF-
> 21A3AC1F75FF">
> >>>>> > > <PatchInformation Description="!(loc.PatchDescription)"
> >>>>> > > Comments="!(loc.PatchDescription)" Manufacturer="$(var.
> >>>>> Manufacturer)"
> >>>>> > > Languages="!(loc.LANG)" ShortNames="no" Compressed="yes"/>
> >>>>> > > <PatchMetadata Description="!(loc.PatchDescription)"
> >>>>> > > ManufacturerName="$(var.Manufacturer)" MoreInfoURL="URL"
> >>>>> > > *AllowRemoval="yes"* Classification="Update" DisplayName="!(loc.
> >>>>> > PatchDisplayName)"
> >>>>> > > TargetProductName="$(var.ProductName)"/>
> >>>>> > > <Family MediaSrcProp="Sample" SequenceStart="5000"
> >>>>> DiskId="5000"
> >>>>> > > Name="Sample">
> >>>>> > > <UpgradeImage SourceFile="Path\1.0.1\admin\New.msi"
> >>>>> > > Id="SampleUpgrade">
> >>>>> > > <TargetImage Order="2" IgnoreMissingFiles="no"
> >>>>> > > SourceFile="Path\1.0.0\admin\old.msi" Id="SampleTarget"/>
> >>>>> > > </UpgradeImage>
> >>>>> > > </Family>
> >>>>> > > <PatchSequence Supersede="yes" PatchFamily="SamplePatchFamily"
> >>>>> > > Sequence="1.0.0.0"/>
> >>>>> > > </PatchCreation>
> >>>>> > > </Wix>
> >>>>> > >
> >>>>> > >
> >>>>> >
> >>>>> > ________________________________________________________________
> >>>>> > ____ 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/
>


More information about the wix-users mailing list